Main Page   Compound List   File List   Compound Members   File Members  

lib/iface/tcpip.c File Reference

TCP/IP interface. More...

#include "tcpip.h"
#include "../gobj/errors.h"
#include "../gobj/threads.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>

Defines

#define GJ_IFACE_TCPIP_STDPORT   2345
 Standard gobj tcpip port.

#define MAXCONNS   10
 Maximal incoming connection count.


Functions

Gj_IfacePortGj_iface_tcpip_openPort (Gj_Ctx* ctx, Gj_Iface* iface, char* addr)
 Open a port. More...

int Gj_iface_tcpip_closePort (Gj_Ctx* ctx, Gj_Iface* iface, Gj_IfacePort* port)
 Close the given port. More...

int Gj_iface_tcpip_write (Gj_Ctx* ctx, Gj_Iface* iface, Gj_IfacePort* port, void* ptr, int size)
 Write data to the port. More...

int Gj_iface_tcpip_read (Gj_Ctx* ctx, Gj_Iface* iface, Gj_IfacePort* port, void* ptr, int size)
 Read data from the port. More...

int Gj_iface_tcpip_read2write (Gj_Ctx* ctx, Gj_Iface* iface, Gj_IfacePort* port)
 Change from read to write mode. More...

int Gj_iface_tcpip_write2read (Gj_Ctx* ctx, Gj_Iface* iface, Gj_IfacePort* port)
 Change from write to read mode . More...

int Gj_iface_tcpip_flush (Gj_Ctx* ctx, Gj_Iface* iface, Gj_IfacePort* port)
 Flush IO buffers. More...

int Gj_iface_tcpip_listen (Gj_Ctx* ctx, Gj_Iface* iface)
 Listen on the interface. More...


Detailed Description

TCP/IP interface.


Function Documentation

Gj_IfacePort * Gj_iface_tcpip_openPort ( Gj_Ctx * ctx,
Gj_Iface * iface,
char * addr )
 

Open a port.

Returns:
A pointer to the new port on success, 0 otherwise

int Gj_iface_tcpip_closePort ( Gj_Ctx * ctx,
Gj_Iface * iface,
Gj_IfacePort * port )
 

Close the given port.

Returns:
0 on success, -1 otherwise.

int Gj_iface_tcpip_write ( Gj_Ctx * ctx,
Gj_Iface * iface,
Gj_IfacePort * port,
void * ptr,
int size )
 

Write data to the port.

Returns:
0 on success, -1 otherwise.

int Gj_iface_tcpip_read ( Gj_Ctx * ctx,
Gj_Iface * iface,
Gj_IfacePort * port,
void * ptr,
int size )
 

Read data from the port.

Returns:
0 on success, -1 otherwise.

int Gj_iface_tcpip_read2write ( Gj_Ctx * ctx,
Gj_Iface * iface,
Gj_IfacePort * port )
 

Change from read to write mode.

Returns:
0 on success, -1 otherwise.

int Gj_iface_tcpip_write2read ( Gj_Ctx * ctx,
Gj_Iface * iface,
Gj_IfacePort * port )
 

Change from write to read mode .

Returns:
0 on success, -1 otherwise.

int Gj_iface_tcpip_flush ( Gj_Ctx * ctx,
Gj_Iface * iface,
Gj_IfacePort * port )
 

Flush IO buffers.

Returns:
0 on success, -1 otherwise.

int Gj_iface_tcpip_listen ( Gj_Ctx * ctx,
Gj_Iface * iface )
 

Listen on the interface.

Listen on the interface until an incoming connection request arrives, establish that connection and fork to gj_iface_serve. Runs until ctx->session->abort is set.

Returns:
0 on success, -1 otherwise.


Generated at Fri Aug 17 18:28:58 2001 for Gobj by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000