libcom_tcp.h File Reference

#include "libicl.h"

Go to the source code of this file.

Defines

#define EXTERN   extern
#define MAX(a, b)   ((a) > (b) ? (a) : (b))

Typedefs

typedef int SOCKET

Functions

EXTERN SOCKET com_Connect (char *ConnectionId, ICLTerm *Address)
 Given a connection ID and an address, initiates a client connection.
EXTERN SOCKET comConnectFormat (char *ConnectionId, ICLTerm *Params, ICLTerm *Address, int format)
EXTERN int com_Disconnect (char *ConnectionId)
 Given a connection ID, shuts down the connection.
EXTERN int com_ListenAt (char *ConnectionId, ICLTerm *Params, ICLTerm *Address)
 Given a connection ID and an address, initiate a server connection.
EXTERN int com_SendData (char *ConnectionId, char *Data, int size)
 Sends data to the specified connection ID.
EXTERN int com_SendTerm (char *ConnectionId, ICLTerm *term)
EXTERN int com_Select (char *ConnectionId, double TimeOut)
EXTERN int com_AddInfo (char *ConnectionId, ICLTerm *NewInfo)
 Records data about the specified connection ID.
EXTERN int com_UpdateInfo (char *ConnectionId, ICLTerm *NewInfo)
 Updates data about the specified connection ID.
EXTERN int com_RemoveInfo (char *ConnectionId, ICLTerm *NewInfo)
 Remove info about the specified connection ID.
EXTERN int com_GetInfo (char *ConnectionId, ICLTerm *GInfo, ICLTerm **Result)
 Looks up info based on the connection id.
EXTERN int com_GetConnectionFromInfo (ICLTerm *Info, char **connectionName)
 Looks up a connection that contains a given information.
EXTERN SOCKET com_Connected (char *ConnectionId)
 Return TRUE if the TCP connection is established.
EXTERN int com_GetAllValidConnections (ICLTerm **result)
EXTERN int com_GetConnectionId (char **ConnectionId, ICLTerm *GInfo)
 Looks up connection id based on oaa_name, oaa_id, or fac_id,.
EXTERN char * com_GetDefaultConnectionId ()
 Looks up the current ConnectionId.
EXTERN int com_SelectEvent (char *ConnectionId, double timeout, ICLTerm **event)
EXTERN void cnx_CanonicalAddress (ICLTerm *address, SOCKET socket, ICLTerm **result)
 Returns address tcp(IPAddr,Port) to connected socket.
EXTERN int com_GetEventFromConnection (char *ConnectionId, double timeout, ICLTerm **event)
 Get an event from a specific connection.
EXTERN int com_SelectEventFromAllIds (double timeout, ICLTerm **event)
 Similar to the original com_SelectEvent(), this function selects from all the connections.

Variables

EXTERN int COM_BEST_FORMAT
EXTERN int COM_STRING_FORMAT
EXTERN int COM_BINARY_FORMAT


Detailed Description

Definition in file libcom_tcp.h.


Define Documentation

#define EXTERN   extern

Definition at line 36 of file libcom_tcp.h.

#define MAX ( a,
 )     ((a) > (b) ? (a) : (b))

Definition at line 40 of file libcom_tcp.h.


Typedef Documentation

typedef int SOCKET

Definition at line 47 of file libcom_tcp.h.


Function Documentation

EXTERN void cnx_CanonicalAddress ( ICLTerm address,
SOCKET  socket,
ICLTerm **  result 
)

Returns address tcp(IPAddr,Port) to connected socket.

Must be connected first, for this to work! Currently, assumes client connection (should change!)

Definition at line 1664 of file libcom_tcp.c.

EXTERN int com_AddInfo ( char *  ConnectionId,
ICLTerm NewInfo 
)

Records data about the specified connection ID.

Info may be status(S), type(T), protocol(P) or any element (or list of elements) to be stored in InfoList.

Returns:
TRUE if success

Definition at line 1048 of file libcom_tcp.c.

EXTERN SOCKET com_Connect ( char *  ConnectionId,
ICLTerm Address 
)

Given a connection ID and an address, initiates a client connection.

Remarks:

Definition at line 219 of file libcom_tcp.c.

EXTERN SOCKET com_Connected ( char *  ConnectionId  ) 

Return TRUE if the TCP connection is established.

Definition at line 675 of file libcom_tcp.c.

EXTERN int com_Disconnect ( char *  ConnectionId  ) 

Given a connection ID, shuts down the connection.

If Id is NULL, shuts down all connections.

Note: Succeeds silently if there is not an open connection having the given id.

Definition at line 639 of file libcom_tcp.c.

EXTERN int com_GetAllValidConnections ( ICLTerm **  result  ) 

Definition at line 701 of file libcom_tcp.c.

EXTERN int com_GetConnectionFromInfo ( ICLTerm Info,
char **  connectionName 
)

Looks up a connection that contains a given information.

Returns:
NULL if fail, an IclTerm if success.

Definition at line 742 of file libcom_tcp.c.

EXTERN int com_GetConnectionId ( char **  ConnectionId,
ICLTerm GInfo 
)

Looks up connection id based on oaa_name, oaa_id, or fac_id,.

Returns:
TRUE if success

Definition at line 1381 of file libcom_tcp.c.

EXTERN char* com_GetDefaultConnectionId (  ) 

Looks up the current ConnectionId.

Assumes there is only one connection ID and returns the first. Returns the connection in a new space which should be free'd.

Returns:
the connectionId or NULL if none available

Definition at line 1634 of file libcom_tcp.c.

EXTERN int com_GetEventFromConnection ( char *  ConnectionId,
double  timeout,
ICLTerm **  event 
)

Get an event from a specific connection.

Definition at line 1969 of file libcom_tcp.c.

EXTERN int com_GetInfo ( char *  ConnectionId,
ICLTerm GInfo,
ICLTerm **  Result 
)

Looks up info based on the connection id.

Returns:
TRUE if success

Definition at line 1306 of file libcom_tcp.c.

EXTERN int com_ListenAt ( char *  ConnectionId,
ICLTerm Params,
ICLTerm Address 
)

Given a connection ID and an address, initiate a server connection.

Remarks:

Definition at line 781 of file libcom_tcp.c.

EXTERN int com_RemoveInfo ( char *  connectionId,
ICLTerm toMatch 
)

Remove info about the specified connection ID.

Info may only be an an element stored in the InfoList

Definition at line 1130 of file libcom_tcp.c.

EXTERN int com_Select ( char *  ConnectionId,
double  TimeOut 
)

EXTERN int com_SelectEvent ( char *  ConnectionId,
double  timeout,
ICLTerm **  event 
)

Definition at line 1428 of file libcom_tcp.c.

EXTERN int com_SelectEventFromAllIds ( double  timeout,
ICLTerm **  event 
)

Similar to the original com_SelectEvent(), this function selects from all the connections.

It also checks the listen sockets, if any, for incoming connection requests.

The main select() statement is contained in com_read_events_into_buffer().

Definition at line 2414 of file libcom_tcp.c.

EXTERN int com_SendData ( char *  ConnectionId,
char *  Data,
int  Size 
)

Sends data to the specified connection ID.

Returns:
TRUE if success

Definition at line 986 of file libcom_tcp.c.

EXTERN int com_SendTerm ( char *  ConnectionId,
ICLTerm term 
)

Definition at line 1012 of file libcom_tcp.c.

EXTERN int com_UpdateInfo ( char *  ConnectionId,
ICLTerm NewInfo 
)

Updates data about the specified connection ID.

Info may be status(S), type(T), protocol(P) or any element (or list of elements) to be stored in InfoList.

Returns:
TRUE if success

Definition at line 1195 of file libcom_tcp.c.

EXTERN SOCKET comConnectFormat ( char *  ConnectionId,
ICLTerm Params,
ICLTerm Address,
int  format 
)

Definition at line 358 of file libcom_tcp.c.


Variable Documentation

EXTERN int COM_BEST_FORMAT

Definition at line 76 of file libcom_tcp.h.

EXTERN int COM_BINARY_FORMAT

Definition at line 78 of file libcom_tcp.h.

EXTERN int COM_STRING_FORMAT

Definition at line 77 of file libcom_tcp.h.


Generated on Wed May 23 17:20:14 2007 using doxygen 1.5.2