BRL-CAD
server.c File Reference
#include "common.h"
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include "bio.h"
#include "bu/log.h"
#include "bu/str.h"
#include "bu/malloc.h"
#include "bu/getopt.h"
#include "pkg.h"
#include "ntp.h"
Include dependency graph for server.c:

Go to the source code of this file.

Functions

void server_helo (struct pkg_conn *connection, char *buf)
 
void server_data (struct pkg_conn *connection, char *buf)
 
void server_ciao (struct pkg_conn *connection, char *buf)
 
void run_server (int port)
 
int main (int argc, char *argv[])
 

Detailed Description

Basic pkg server.

Definition in file server.c.

Function Documentation

void server_helo ( struct pkg_conn connection,
char *  buf 
)

callback when a HELO message packet is received.

We should not encounter this packet specifically since we listened for it before beginning processing of packets as part of a simple handshake setup.

Definition at line 77 of file server.c.

References bu_log().

Referenced by run_server().

Here is the call graph for this function:

void server_data ( struct pkg_conn connection,
char *  buf 
)

callback when a DATA message packet is received

Definition at line 88 of file server.c.

References bu_log().

Referenced by run_server().

Here is the call graph for this function:

void server_ciao ( struct pkg_conn connection,
char *  buf 
)

callback when a CIAO message packet is received

Definition at line 99 of file server.c.

References bu_log().

Referenced by run_server().

Here is the call graph for this function:

void run_server ( int  port)

start up a server that listens for a single client.

our server callbacks for each message type

Definition at line 110 of file server.c.

References bu_bomb(), bu_calloc(), bu_free(), bu_log(), BU_STR_EQUAL, MAGIC_ID, MAX_DIGITS, MSG_CIAO, MSG_DATA, MSG_HELO, PKC_ERROR, PKC_NULL, pkg_bwaitfor(), pkg_close(), pkg_getclient(), pkg_permserver(), pkg_send(), server_ciao(), server_data(), and server_helo().

Referenced by main().

Here is the call graph for this function:

int main ( int  argc,
char *  argv[] 
)

main application for both the client and server

Definition at line 213 of file server.c.

References bu_getopt(), bu_log(), bu_optarg, bu_optind, bu_optopt, and run_server().

Here is the call graph for this function: