The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::SixXS::TIC::Server - the core of a Tunnel Information and Control protocol server

SYNOPSIS

See the documentation of the descendant classes - Net::SixXS::TIC::Server::AnyEvent or Net::SixXS::TIC::Server::Inetd.

DESCRIPTION

The Net::SixXS::TIC::Server class implements the core operation of a Tunnel Information and Control (TIC) server as used to configure IPv6-over-IPv4 tunnels using the Anything-In-Anything (AYIYA) protocol. It may be part of a local testing setup for TIC/AYIYA clients.

The Net::SixXS::TIC::Server class is not a full implementation of a TIC server; it keeps the necessary amount of state (including tunnel information), provides methods for executing the TIC protocol commands, and requires a client_write_line() method to be overridden by the descendant classes to actually communicate with the client. For an implementation, see the Net::SixXS::TIC::Server::AnyEvent and Net::SixXS::TIC::Server::Inetd classes and the sixxs-tic-server sample script provided with the Net-SixXS distribution.

ATTRIBUTES

The operation of a Net::SixXS::TIC::Server object is configured by the following attributes:

username

The only username that the server will accept for authentication.

password

The password that the server will accept for authentication.

tunnels

The tunnels that the server will return information for as a hash reference with tunnel identifiers (e.g. "T22948") as keys and Net::SixXS::Data::Tunnel objects as values.

clients

An internal structure with information about the state of the clients currently connected to the server.

server_name

The text identifier of the TIC server; defaults to "Net-SixXS".

server_version

The text string representing the TIC server's version; defaults to the version of the Net-SixXS distribution.

diag

The Net::SixXS::Diag object to send diagnostic messages to; defaults to the one provided by the diag() function of the Net::SixXS class.

Note that the Net::SixXS::TIC::Server object obtains the default value for diag when it is constructed; thus, a program would usually set the Net::SixXS:diag() logger early, before creating any actual objects from the Net::SixXS hierarchy

METHODS

The Net::SixXS::TIC::Server class defines the following methods:

greet_client (client)

Send the TIC protocol server greeting to the specified client.

client_write_line (client, line)

A stub for the actual method that will send a line to the TIC client; must be overridden by the descendant classes.

_cmd_authenticate (client, command, args)

Internal method invoked by run_command(); process the actual TIC authentication, making sure that the "authenticate" command is not sent out of sequence, verify the client's username and password against the username and password attributes and the session authentication challenge, and send back a TIC success response.

_cmd_challenge (client, command, args)

Internal method invoked by run_command(); process the next step of the TIC authentication, making sure that the "challenge" command is not sent out of sequence, generate a pseudo-random challenge string, and send it back in a TIC success response.

_cmd_client (client, command, args)

Internal method invoked by run_command(); process a TIC protocol client greeting with no actual checks, but create an internal record of the client information and send back a TIC success response.

_cmd_get_unixtime (client, command, args)

Internal method invoked by run_command(); send the current Unix time (the number of seconds from the epoch) to the client.

_cmd_quit (client, command, args)

Internal method invoked by run_command(); process a session end request from the client, set the shutdown flag in the client structure, and send back a TIC success response.

_cmd_tunnel_list (client, command, args)

Internal method invoked by run_command(); make sure that the client is authenticated and send back a list of the tunnel identifiers in a multiline TIC success response.

_cmd_tunnel_show (client, command, args)

Internal method invoked by run_command(); make sure that the client is authenticated and send back detailed information about a single tunnel in a multiline TIC success response.

_cmd_username (client, command, args)

Internal method invoked by run_command(); process the start of the TIC authentication, making sure that the "username" command is not sent out of sequence, make a note of the client's specified username, and send back a TIC success response.

run_command (client, command)

Handle a text line received from a TIC client; the actual communication with the client to receive the commands is handled by the descendant classes which subsequently invoke this method. Make sure the command is in a valid format, then invoke the corresponding method (one of the _cmd_*() ones listed above) to execute the command and send a response back to the client.

debug (message)

Internal method; sends the message to the object's diag logger if the latter is set.

SEE ALSO

Net::SixXS::Data::Tunnel, Net::SixXS::Diag, Net::SixXS::TIC::Client, Net::SixXS::TIC::Server::AnyEvent, Net::SixXS::TIC::Server::Inetd

LICENSE

Copyright (C) 2015 Peter Pentchev <roam@ringlet.net>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Peter Pentchev <roam@ringlet.net>