libsent/include/sent/tcpip.h File Reference

Definitions relating TCP/IP Networking. More...

#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <sys/file.h>
#include <sys/types.h>
#include <fcntl.h>

Include dependency graph for tcpip.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ADINNET_PORT   5530
 Default port number of A/D-in server (adinnet).
#define NETAUDIO_DEVNAME   "localhost:0"
 Default Host/unit name for NetAudio/DatLink input.
#define CONNECTION_RETRY_TIMES   5
 Retry time when client connection failed */.
#define CONNECTION_RETRY_INTERVAL   2
 Interval time between retry in seconds.

Functions

int rd (int fd, char *data, int *len, int maxlen)
 Read a data segment from a network stream.
int wt (int fd, char *data, int len)
 Write a data segment to a network stream.
int ready_as_server (int port_num)
int accept_from (int sd)
 Wait for a request from client.
int make_connection (char *hostname, int port_num)
int make_connection_unix (char *address)
int close_socket (int sd)
void cleanup_socket ()


Detailed Description

Definitions relating TCP/IP Networking.

Author:
Akinobu LEE
Date:
Sat Feb 12 12:26:15 2005
Revision
1.4

Definition in file tcpip.h.


Function Documentation

int rd ( int  fd,
char *  data,
int *  len,
int  maxlen 
)

Read a data segment from a network stream.

This function will block until the specified length has been received.

Parameters:
fd [in] file descriptor
data [out] buffer to store the read data
len [out] received length in bytes
maxlen [in] maximum length of data buffer in bytes
Returns:
received data length in bytes, or -1 on error.

Definition at line 43 of file rdwt.c.

Referenced by adin_tcpip_read().

int wt ( int  fd,
char *  data,
int  len 
)

Write a data segment to a network stream.

Parameters:
fd [in] file descriptor
data [in] buffer that holds data to write
len [out] received length in bytes
Returns:
actually written data length in bytes, or -1 on error.

Definition at line 92 of file rdwt.c.

Referenced by adin_tcpip_send_pause(), adin_tcpip_send_resume(), and adin_tcpip_send_terminate().

int ready_as_server ( int  port_num  ) 

Prepare as a server creating a socket for client connection.

Parameters:
port_num [in] network port to listen.
Returns:
socket descriptor, or -1 if failed to create socket, -2 if failed to bind, or -3 if failed to listen.

Definition at line 40 of file server-client.c.

Referenced by adin_tcpip_standby(), and main_module_loop().

int accept_from ( int  sd  ) 

Wait for a request from client.

This function blocks until a connection request comes.

Parameters:
sd [in] listening server socket descpritor
Returns:
the connected socket descriptor.

Definition at line 116 of file server-client.c.

Referenced by adin_tcpip_begin(), and main_module_loop().

int make_connection ( char *  hostname,
int  port_num 
)

Make a connection to a server.

Parameters:
hostname [in] server host (host name or numeric IP address)
port_num [in] port number
Returns:
new socket descriptor, -1 if fails to prepare socket, -2 if fails to connect, -3 if host name is wrong.

Definition at line 161 of file server-client.c.

int make_connection_unix ( char *  address  ) 

Make a connection to a server using unix domain socket.

Parameters:
address [in] unix domain socket address (path)
Returns:
new socket descriptor, -1 if fails to prepare socket, -2 if fails to connect.

Definition at line 244 of file server-client.c.

int close_socket ( int  sd  ) 

Close socket.

Parameters:
sd [in] socket descriptor to close
Returns:
0 on success, -1 on failure.

Definition at line 277 of file server-client.c.

Referenced by adin_tcpip_end(), main_module_loop(), and module_disconnect().

void cleanup_socket (  ) 

Clean up socket data at program exit.

Definition at line 293 of file server-client.c.

Referenced by j_error(), and j_exit().


Generated on Tue Dec 26 16:17:27 2006 for Julius by  doxygen 1.5.0