Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

Network Transport Layer
[Networking Functions]

This file contains the definition of a GWEN_NETTRANSPORT. More...

Transport Layer Flags

#define GWEN_NETTRANSPORT_FLAGS_EOF_IN   0x0002
#define GWEN_NETTRANSPORT_FLAGS_EOF_OUT   0x0004
#define GWEN_NETTRANSPORT_FLAGS_PASSIVE   0x0001
#define GWEN_NETTRANSPORT_FLAGS_RESTARTABLE   0x0008
#define GWEN_NETTRANSPORT_FLAGS_WAS_LCONNECTED   0x0010
#define GWEN_NETTRANSPORT_FLAGS_WENT_DOWN   0x0020

Prototypes For Virtual Functions

typedef int(* GWEN_NETTRANSPORT_ADDSOCKETS )(GWEN_NETTRANSPORT *tr, GWEN_SOCKETSET *sset, int forReading)
typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_READ )(GWEN_NETTRANSPORT *tr, char *buffer, int *bsize)
typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_STARTACCEPT )(GWEN_NETTRANSPORT *tr)
typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_STARTCONNECT )(GWEN_NETTRANSPORT *tr)
typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_STARTDISCONNECT )(GWEN_NETTRANSPORT *tr)
typedef GWEN_NETTRANSPORT_WORKRESULT(* GWEN_NETTRANSPORT_WORK )(GWEN_NETTRANSPORT *tr)
typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_WRITE )(GWEN_NETTRANSPORT *tr, const char *buffer, int *bsize)

Informational Functions

GWENHYWFAR_API void GWEN_NetTransport_AddFlags (GWEN_NETTRANSPORT *tr, GWEN_TYPE_UINT32 flags)
GWENHYWFAR_API void GWEN_NetTransport_DelFlags (GWEN_NETTRANSPORT *tr, GWEN_TYPE_UINT32 flags)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetTransport_GetBackLog (const GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetTransport_GetFlags (const GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API double GWEN_NetTransport_GetIdleTime (const GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetTransport_GetIncomingCount (const GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API const GWEN_INETADDRESSGWEN_NetTransport_GetLocalAddr (const GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API const GWEN_INETADDRESSGWEN_NetTransport_GetPeerAddr (const GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API GWEN_NETTRANSPORT_STATUS GWEN_NetTransport_GetStatus (const GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API void GWEN_NetTransport_MarkActivity (GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API const char * GWEN_NetTransport_ResultName (GWEN_NETTRANSPORT_RESULT res)
GWENHYWFAR_API void GWEN_NetTransport_SetBackLog (GWEN_NETTRANSPORT *tr, GWEN_TYPE_UINT32 i)
GWENHYWFAR_API void GWEN_NetTransport_SetFlags (GWEN_NETTRANSPORT *tr, GWEN_TYPE_UINT32 flags)
GWENHYWFAR_API void GWEN_NetTransport_SetLocalAddr (GWEN_NETTRANSPORT *tr, const GWEN_INETADDRESS *addr)
GWENHYWFAR_API void GWEN_NetTransport_SetPeerAddr (GWEN_NETTRANSPORT *tr, const GWEN_INETADDRESS *addr)
GWENHYWFAR_API void GWEN_NetTransport_SetStatus (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_STATUS st)
GWENHYWFAR_API const char * GWEN_NetTransport_StatusName (GWEN_NETTRANSPORT_STATUS st)

Functions For Inheritors

GWENHYWFAR_API void GWEN_NetTransport_AddNextIncoming (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT *newTr)

Working

GWENHYWFAR_API int GWEN_NetTransport_AddSockets (GWEN_NETTRANSPORT *tr, GWEN_SOCKETSET *sset, int forReading)
GWENHYWFAR_API GWEN_NETTRANSPORT_WORKRESULT GWEN_NetTransport_Work (GWEN_NETTRANSPORT *tr)

Constructor And Destructor

void GWEN_NetTransport_free (GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API GWEN_NETTRANSPORTGWEN_NetTransport_new ()

Connect And Disconnect

GWENHYWFAR_API GWEN_NETTRANSPORTGWEN_NetTransport_GetNextIncoming (GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_StartAccept (GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_StartConnect (GWEN_NETTRANSPORT *tr)
GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_StartDisconnect (GWEN_NETTRANSPORT *tr)

Reading And Writing

GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_Read (GWEN_NETTRANSPORT *tr, char *buffer, int *bsize)
GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_Write (GWEN_NETTRANSPORT *tr, const char *buffer, int *bsize)

Getters And Setters For Inheritors

GWENHYWFAR_API void GWEN_NetTransport_SetAddSocketsFn (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_ADDSOCKETS fn)
GWENHYWFAR_API void GWEN_NetTransport_SetReadFn (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_READ fn)
GWENHYWFAR_API void GWEN_NetTransport_SetStartAcceptFn (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_STARTACCEPT fn)
GWENHYWFAR_API void GWEN_NetTransport_SetStartConnectFn (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_STARTCONNECT fn)
GWENHYWFAR_API void GWEN_NetTransport_SetStartDisconnectFn (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_STARTDISCONNECT fn)
GWENHYWFAR_API void GWEN_NetTransport_SetWorkFn (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_WORK fn)
GWENHYWFAR_API void GWEN_NetTransport_SetWriteFn (GWEN_NETTRANSPORT *tr, GWEN_NETTRANSPORT_WRITE fn)

Enumerations

enum  GWEN_NETTRANSPORT_RESULT {
  GWEN_NetTransportResultOk = 0, GWEN_NetTransportResultError, GWEN_NetTransportResultWantRead, GWEN_NetTransportResultWantWrite,
  GWEN_NetTransportResultAborted
}
enum  GWEN_NETTRANSPORT_STATUS {
  GWEN_NetTransportStatusUnconnected = 0, GWEN_NetTransportStatusPConnecting, GWEN_NetTransportStatusPConnected, GWEN_NetTransportStatusLConnecting,
  GWEN_NetTransportStatusLConnected, GWEN_NetTransportStatusLDisconnecting, GWEN_NetTransportStatusLDisconnected, GWEN_NetTransportStatusPDisconnecting,
  GWEN_NetTransportStatusPDisconnected, GWEN_NetTransportStatusListening, GWEN_NetTransportStatusDisabled
}

Detailed Description

This file contains the definition of a GWEN_NETTRANSPORT.

All functions in this group are expected to be non-blocking. If any of the functions is unable to momentarily perform the action it is supposed to perform it should return either GWEN_NetTransportResultWantRead or GWEN_NetTransportResultWantWrite.


Define Documentation

#define GWEN_NETTRANSPORT_FLAGS_EOF_IN   0x0002
 

#define GWEN_NETTRANSPORT_FLAGS_EOF_OUT   0x0004
 

no longer used

#define GWEN_NETTRANSPORT_FLAGS_PASSIVE   0x0001
 

#define GWEN_NETTRANSPORT_FLAGS_RESTARTABLE   0x0008
 

#define GWEN_NETTRANSPORT_FLAGS_WAS_LCONNECTED   0x0010
 

#define GWEN_NETTRANSPORT_FLAGS_WENT_DOWN   0x0020
 


Typedef Documentation

typedef int(* GWEN_NETTRANSPORT_ADDSOCKETS)(GWEN_NETTRANSPORT *tr, GWEN_SOCKETSET *sset, int forReading)
 

This function is called when a connection manager tries to gather sockets to be used with GWEN_Socket_Select. Transport which actually do not use GWEN_Sockets should return GWEN_NetTransportResultOk without doing anything.

Parameters:
sset pointer to the socket set to which sockets should be added
forReading if !=0 then readable sockets are requested

typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_READ)(GWEN_NETTRANSPORT *tr, char *buffer, int *bsize)
 

This function tries to read data.

Parameters:
buffer pointer to a buffer for the data
bsize pointer to a variable which holds the maxmimum number of bytes to read. Upon return this variable contains the number of bytes actually read.

typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_STARTACCEPT)(GWEN_NETTRANSPORT *tr)
 

This function starts to passively await connections from other hosts. Please note that this function MUST set the status accordingly (using GWEN_NetTransport_SetStatus).

typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_STARTCONNECT)(GWEN_NETTRANSPORT *tr)
 

This function starts to actively connect to another host. Please note that this function MUST set the status accordingly (using GWEN_NetTransport_SetStatus).

typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_STARTDISCONNECT)(GWEN_NETTRANSPORT *tr)
 

This function starts to disconnect from another host. Please note that this function MUST set the status accordingly (using GWEN_NetTransport_SetStatus).

typedef GWEN_NETTRANSPORT_WORKRESULT(* GWEN_NETTRANSPORT_WORK)(GWEN_NETTRANSPORT *tr)
 

Allows the transport layer to do some work.

typedef GWEN_NETTRANSPORT_RESULT(* GWEN_NETTRANSPORT_WRITE)(GWEN_NETTRANSPORT *tr, const char *buffer, int *bsize)
 

This function tries to write data.

Parameters:
buffer pointer to a buffer with the data
bsize pointer to a variable which holds the maxmimum number of bytes to write. Upon return this variable contains the number of bytes actually written.


Enumeration Type Documentation

enum GWEN_NETTRANSPORT_RESULT
 

These are the result codes to be returned by functions of this group.

Enumeration values:
GWEN_NetTransportResultOk  Function succeeded
GWEN_NetTransportResultError  Function failed
GWEN_NetTransportResultWantRead  The transport layer needs to read in order to perform the called function. The caller may then use this information for a call to select.
GWEN_NetTransportResultWantWrite  The transport layer needs to write in order to perform the called function. The caller may then use this information for a call to select.
GWEN_NetTransportResultAborted  The called function has been aborted by the user (via the WaitCallBack mechanism)

enum GWEN_NETTRANSPORT_STATUS
 

This is the status of the transport layer.

Enumeration values:
GWEN_NetTransportStatusUnconnected  neither connected nor listening, this is the initial state
GWEN_NetTransportStatusPConnecting  physically connecting
GWEN_NetTransportStatusPConnected  physically connected
GWEN_NetTransportStatusLConnecting  logically connecting
GWEN_NetTransportStatusLConnected  logically connected
GWEN_NetTransportStatusLDisconnecting  logically disconnecting
GWEN_NetTransportStatusLDisconnected  logically disconnected
GWEN_NetTransportStatusPDisconnecting  physically disconnecting
GWEN_NetTransportStatusPDisconnected  physically disconnected
GWEN_NetTransportStatusListening  listening
GWEN_NetTransportStatusDisabled  disabled


Function Documentation

GWENHYWFAR_API void GWEN_NetTransport_AddFlags GWEN_NETTRANSPORT tr,
GWEN_TYPE_UINT32  flags
 

GWENHYWFAR_API void GWEN_NetTransport_AddNextIncoming GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT newTr
 

GWENHYWFAR_API int GWEN_NetTransport_AddSockets GWEN_NETTRANSPORT tr,
GWEN_SOCKETSET sset,
int  forReading
 

This function is called when a connection manager tries to gather sockets to be used with GWEN_Socket_Select. Transport which actually do not use GWEN_Sockets should return GWEN_NetTransportResultOk without doing anything.

Parameters:
sset pointer to the socket set to which sockets should be added
forReading if !=0 then readable sockets are requested

GWENHYWFAR_API void GWEN_NetTransport_DelFlags GWEN_NETTRANSPORT tr,
GWEN_TYPE_UINT32  flags
 

void GWEN_NetTransport_free GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetTransport_GetBackLog const GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetTransport_GetFlags const GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API double GWEN_NetTransport_GetIdleTime const GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetTransport_GetIncomingCount const GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API const GWEN_INETADDRESS* GWEN_NetTransport_GetLocalAddr const GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API GWEN_NETTRANSPORT* GWEN_NetTransport_GetNextIncoming GWEN_NETTRANSPORT tr  ) 
 

Returns the next incoming connection if the transport layer is in listening state (or 0 if there is none).

GWENHYWFAR_API const GWEN_INETADDRESS* GWEN_NetTransport_GetPeerAddr const GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API GWEN_NETTRANSPORT_STATUS GWEN_NetTransport_GetStatus const GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API void GWEN_NetTransport_MarkActivity GWEN_NETTRANSPORT tr  ) 
 

GWENHYWFAR_API GWEN_NETTRANSPORT* GWEN_NetTransport_new  ) 
 

GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_Read GWEN_NETTRANSPORT tr,
char *  buffer,
int *  bsize
 

This function tries to read data.

Parameters:
buffer pointer to a buffer for the data
bsize pointer to a variable which holds the maxmimum number of bytes to read. Upon return this variable contains the number of bytes actually read.

GWENHYWFAR_API const char* GWEN_NetTransport_ResultName GWEN_NETTRANSPORT_RESULT  res  ) 
 

GWENHYWFAR_API void GWEN_NetTransport_SetAddSocketsFn GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_ADDSOCKETS  fn
 

GWENHYWFAR_API void GWEN_NetTransport_SetBackLog GWEN_NETTRANSPORT tr,
GWEN_TYPE_UINT32  i
 

GWENHYWFAR_API void GWEN_NetTransport_SetFlags GWEN_NETTRANSPORT tr,
GWEN_TYPE_UINT32  flags
 

GWENHYWFAR_API void GWEN_NetTransport_SetLocalAddr GWEN_NETTRANSPORT tr,
const GWEN_INETADDRESS addr
 

GWENHYWFAR_API void GWEN_NetTransport_SetPeerAddr GWEN_NETTRANSPORT tr,
const GWEN_INETADDRESS addr
 

GWENHYWFAR_API void GWEN_NetTransport_SetReadFn GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_READ  fn
 

GWENHYWFAR_API void GWEN_NetTransport_SetStartAcceptFn GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_STARTACCEPT  fn
 

GWENHYWFAR_API void GWEN_NetTransport_SetStartConnectFn GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_STARTCONNECT  fn
 

GWENHYWFAR_API void GWEN_NetTransport_SetStartDisconnectFn GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_STARTDISCONNECT  fn
 

GWENHYWFAR_API void GWEN_NetTransport_SetStatus GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_STATUS  st
 

GWENHYWFAR_API void GWEN_NetTransport_SetWorkFn GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_WORK  fn
 

GWENHYWFAR_API void GWEN_NetTransport_SetWriteFn GWEN_NETTRANSPORT tr,
GWEN_NETTRANSPORT_WRITE  fn
 

GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_StartAccept GWEN_NETTRANSPORT tr  ) 
 

This function starts to passively await connections from other hosts. Please note that this function MUST set the status accordingly (using GWEN_NetTransport_SetStatus).

GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_StartConnect GWEN_NETTRANSPORT tr  ) 
 

This function starts to actively connect to another host. Please note that this function MUST set the status accordingly (using GWEN_NetTransport_SetStatus).

GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_StartDisconnect GWEN_NETTRANSPORT tr  ) 
 

This function starts to disconnect from another host. Please note that this function MUST set the status accordingly (using GWEN_NetTransport_SetStatus).

GWENHYWFAR_API const char* GWEN_NetTransport_StatusName GWEN_NETTRANSPORT_STATUS  st  ) 
 

GWENHYWFAR_API GWEN_NETTRANSPORT_WORKRESULT GWEN_NetTransport_Work GWEN_NETTRANSPORT tr  ) 
 

Allows the transport layer to do some work.

GWENHYWFAR_API GWEN_NETTRANSPORT_RESULT GWEN_NetTransport_Write GWEN_NETTRANSPORT tr,
const char *  buffer,
int *  bsize
 

This function tries to write data.

Parameters:
buffer pointer to a buffer with the data
bsize pointer to a variable which holds the maxmimum number of bytes to write. Upon return this variable contains the number of bytes actually written.


Generated on Thu Oct 13 04:23:20 2005 for gwenhywfar by  doxygen 1.4.1