inetsocket.h File Reference

This file contains sockets and socket sets. More...

`#include <gwenhywfar/gwenhywfarapi.h>`
`#include <gwenhywfar/error.h>`
`#include <gwenhywfar/inetaddr.h>`
`#include <gwenhywfar/list1.h>`
`#include <gwenhywfar/list2.h>`

Go to the source code of this file.

## Macros

#define | GWEN_SOCKET_FLAGS_DUMP_READ 0x00000001
#define | GWEN_SOCKET_FLAGS_DUMP_WRITE 0x00000002

## Typedefs

typedef struct GWEN_SOCKET | GWEN_SOCKET
typedef struct GWEN_SOCKETSETSTRUCT | GWEN_SOCKETSET

## Functions

Creation and destruction
GWENHYWFAR_API int | GWEN_Socket_Close (GWEN_SOCKET *sp)
GWENHYWFAR_API void | GWEN_Socket_free (GWEN_SOCKET *sp)
GWENHYWFAR_API GWEN_SOCKET * | GWEN_Socket_fromFile (int fd)
GWENHYWFAR_API GWEN_SOCKET * | GWEN_Socket_new (GWEN_SOCKETTYPE socketType)
GWENHYWFAR_API int | GWEN_Socket_Open (GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_SocketSet_Clear (GWEN_SOCKETSET *ssp)
GWENHYWFAR_API void | GWEN_SocketSet_free (GWEN_SOCKETSET *ssp)
GWENHYWFAR_API GWEN_SOCKETSET * | GWEN_SocketSet_new (void)
Add, remove, check sockets
These functions allow adding and removing sockets to/from a socket set as well as checking whether a specific socket is part of a socket set.
GWENHYWFAR_API int | GWEN_SocketSet_AddSocket (GWEN_SOCKETSET *ssp, const GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_SocketSet_GetSocketCount (GWEN_SOCKETSET *ssp)
GWENHYWFAR_API int | GWEN_SocketSet_HasSocket (GWEN_SOCKETSET *ssp, const GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_SocketSet_RemoveSocket (GWEN_SOCKETSET *ssp, const GWEN_SOCKET *sp)
Connecting and Disconnecting
These functions allow active and passive connections to other hosts.
GWENHYWFAR_API int | GWEN_Socket_Accept (GWEN_SOCKET *sp, GWEN_INETADDRESS **addr, GWEN_SOCKET **newsock)
GWENHYWFAR_API int | GWEN_Socket_Bind (GWEN_SOCKET *sp, const GWEN_INETADDRESS *addr)
GWENHYWFAR_API int | GWEN_Socket_Connect (GWEN_SOCKET *sp, const GWEN_INETADDRESS *addr)
GWENHYWFAR_API int | GWEN_Socket_Listen (GWEN_SOCKET *sp, int backlog)
Informational Functions
These functions return some usefull information about sockets or connections.
GWENHYWFAR_API void | GWEN_Socket_AddFlags (GWEN_SOCKET *sp, uint32_t f)
GWENHYWFAR_API uint32_t | GWEN_Socket_GetFlags (const GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_Socket_GetPeerAddr (GWEN_SOCKET *sp, GWEN_INETADDRESS **addr)
GWENHYWFAR_API GWEN_SOCKETTYPE | GWEN_Socket_GetSocketType (GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_Socket_Select (GWEN_SOCKETSET *rs, GWEN_SOCKETSET *ws, GWEN_SOCKETSET *xs, int timeout)
GWENHYWFAR_API void | GWEN_Socket_SubFlags (GWEN_SOCKET *sp, uint32_t f)
GWENHYWFAR_API int | GWEN_Socket_WaitForRead (GWEN_SOCKET *sp, int timeout)
GWENHYWFAR_API int | GWEN_Socket_WaitForWrite (GWEN_SOCKET *sp, int timeout)
Data Exchange Functions
These functions handle exchange of data with other hosts via the Internet Protocol.
GWENHYWFAR_API int | GWEN_Socket_Read (GWEN_SOCKET *sp, char *buffer, int *bsize)
GWENHYWFAR_API int | GWEN_Socket_ReadFrom (GWEN_SOCKET *sp, GWEN_INETADDRESS **addr, char *buffer, int *bsize)
GWENHYWFAR_API int | GWEN_Socket_Write (GWEN_SOCKET *sp, const char *buffer, int *bsize)
GWENHYWFAR_API int | GWEN_Socket_WriteTo (GWEN_SOCKET *sp, const GWEN_INETADDRESS *addr, const char *buffer, int *bsize)
Socket Settings Functions
These functions manipulate settings on a socket.
GWENHYWFAR_API int | GWEN_Socket_GetSocketError (GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_Socket_GetSocketInt (const GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_Socket_SetBlocking (GWEN_SOCKET *sp, int fl)
GWENHYWFAR_API int | GWEN_Socket_SetBroadcast (GWEN_SOCKET *sp, int fl)
GWENHYWFAR_API int | GWEN_Socket_SetReuseAddress (GWEN_SOCKET *sp, int fl)

## Error Codes

#define | GWEN_SOCKET_ERROR_ABORTED (-8)
#define | GWEN_SOCKET_ERROR_BAD_SOCKETTYPE (-1)
#define | GWEN_SOCKET_ERROR_BROKEN_PIPE (-9)
#define | GWEN_SOCKET_ERROR_IN_PROGRESS (-4)
#define | GWEN_SOCKET_ERROR_INTERRUPTED (-6)
#define | GWEN_SOCKET_ERROR_NOT_OPEN (-2)
#define | GWEN_SOCKET_ERROR_STARTUP (-5)
#define | GWEN_SOCKET_ERROR_TIMEOUT (-3)
#define | GWEN_SOCKET_ERROR_TYPE "Socket"
#define | GWEN_SOCKET_ERROR_UNSUPPORTED (-7)
enum | GWEN_SOCKETTYPE { GWEN_SocketTypeTCP =1 , GWEN_SocketTypeUDP , GWEN_SocketTypeRAW , GWEN_SocketTypeUnix , GWEN_SocketTypeFile }

## Detailed Description

This file contains sockets and socket sets.

Definition in file inetsocket.h.

## Macro Definition Documentation

## GWEN_SOCKET_FLAGS_DUMP_READ

#define GWEN_SOCKET_FLAGS_DUMP_READ 0x00000001

Definition at line 40 of file inetsocket.h.

## GWEN_SOCKET_FLAGS_DUMP_WRITE

#define GWEN_SOCKET_FLAGS_DUMP_WRITE 0x00000002

Definition at line 41 of file inetsocket.h.

## Typedef Documentation

## GWEN_SOCKET

typedef struct GWEN_SOCKET GWEN_SOCKET

Definition at line 44 of file inetsocket.h.

## GWEN_SOCKETSET

typedef struct GWEN_SOCKETSETSTRUCT GWEN_SOCKETSET

Definition at line 45 of file inetsocket.h.