# nettransport.h File Reference

`#include <gwenhywfar/gwenhywfarapi.h>`
`#include <gwenhywfar/types.h>`
`#include <gwenhywfar/inetaddr.h>`
`#include <gwenhywfar/inetsocket.h>`
`#include <gwenhywfar/misc.h>`
`#include <gwenhywfar/inherit.h>`

Go to the source code of this file.

## 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_INETADDRESS * | GWEN_NetTransport_GetLocalAddr (const GWEN_NETTRANSPORT *tr)
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 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_NETTRANSPORT * | GWEN_NetTransport_new ()

## Connect And Disconnect

GWENHYWFAR_API GWEN_NETTRANSPORT * | GWEN_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)

## Typedefs

typedef GWEN_NETTRANSPORT | GWEN_NETTRANSPORT

## 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
}

enum | GWEN_NETTRANSPORT_WORKRESULT { GWEN_NetTransportWorkResult_NoChange = 0, GWEN_NetTransportWorkResult_Change, GWEN_NetTransportWorkResult_Error }

## Typedef Documentation

typedef struct GWEN_NETTRANSPORT GWEN_NETTRANSPORT

## Enumeration Type Documentation

enum GWEN_NETTRANSPORT_WORKRESULT

Enumerator:

  GWEN_NetTransportWorkResult_NoChange |
  GWEN_NetTransportWorkResult_Change |
  GWEN_NetTransportWorkResult_Error |