#include "isisserver.h"
#include <readline/readline.h>
#include <readline/history.h>
Functions | |
int | openSocket (int isisPort) |
Open and setup the ISIS server UDP network socket. | |
void | closeSocket (int sockFD) |
Close the ISIS server socket. | |
int | initSerialPorts () |
Initialize the serial ports listed in the server's serial port table. | |
int | getSerialInfo (int testFD) |
Map a serial port file descriptor onto a serial port table index. | |
void | handShake () |
Handshake with the clients on serial ports and preset UDP ports. | |
void | serialHandler (int serialFD) |
Handle input from server serial ports. | |
void | socketHandler (int sockFD) |
Handle input from a network client socket. | |
void | ttyHandler (char *ttyStr) |
Handle input from the command line (readline callback function). |
... description of the ISIS server interfaces ...
Three basic routines are provided for handling input message traffic on the various server interfaces:
|
Open and setup the ISIS server UDP network socket.
Errors are reported to stdout by this routine.
|
|
Close the ISIS server socket.
|
|
Initialize the serial ports listed in the server's serial port table.
|
|
Map a serial port file descriptor onto a serial port table index.
testFD in the server's active serial port table, and returns the index of the port table entry if found. The serial port table is the ttyTab struct defined in the isisserver.h header file. |
|
Handshake with the clients on serial ports and preset UDP ports. Sends a ">AL PING" message to all open serial ports and all preset UDP ports. This is a blind broadcast that should lead to "PONG"s back from any ISIS clients on the serial lines or connected to the UDP socket ports. This is a placeholder that gives us minimal IMPv2 software handshaking until we can work with the system some and work out better procedures. All strings transmitted to raw ports must be in proper IMPv2-conformal format, terminated by \r (ASCII 13). |
|
Handle input from server serial ports.
If the source and destination are valid, and the message is not blank or malformed, it then passes the message off to HandleMessage() to route the message to its intended recipient. When generating IMPv2 messages for direct transmission through the server, the strings must be terminated with return (\r = ASCII 13) not a newline (\n = ASCII 10). This function is designed to be invoked by a select() loop that watches particular file descriptors. See main.c for how it is implemented. |
|
Handle input from a network client socket.
If the source and destination are valid, and the message is not blank or malformed, it then passes control off to handleMessage() to do the dirty work. This may permit us to enable multithreading in the future. When generating IMPv2-compliant messages, the strings must be terminated with return (\r = ASCII 13) not a newline (\n = ASCII 10). This function is designed to be invoked by a select() loop that watches particular file descriptors. See main.c for how it is implemented. |
|
Handle input from the command line (readline callback function).
rl_callback_hander_install() function of the readline library.Once we get an error-free string we can use, we then try to interpret it. This is the main cli handler for the server. When generating IMPv2 messages for direct transmission onto the system, the strings must be terminated with return (\r = ASCII 13) not a newline (\n = ASCII 10). |