X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=lhnet.h;h=e7ac0e48294dc79878e01b17c5f2bb16b48552b7;hb=a9066a704f0604d4fb183b80ebc94b692e1e17d1;hp=518ccdf91566a5bda09fa5fe27776b7ed7d5a40f;hpb=cfee52a1ec9db338098789cae89ae5cf1f7a6fbf;p=xonotic%2Fdarkplaces.git diff --git a/lhnet.h b/lhnet.h index 518ccdf9..e7ac0e48 100644 --- a/lhnet.h +++ b/lhnet.h @@ -1,9 +1,12 @@ -// Written by Forest Hale 2003-06-15 and placed into public domain. +// Written by Ashley Rose Hale (LadyHavoc) 2003-06-15 and placed into public domain. #ifndef LHNET_H #define LHNET_H +#include +#include "com_list.h" + typedef enum lhnetaddresstype_e { LHNETADDRESSTYPE_NONE, @@ -24,7 +27,13 @@ lhnetaddress_t; int LHNETADDRESS_FromPort(lhnetaddress_t *address, lhnetaddresstype_t addresstype, int port); int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int defaultport); int LHNETADDRESS_ToString(const lhnetaddress_t *address, char *string, int stringbuffersize, int includeport); -int LHNETADDRESS_GetAddressType(const lhnetaddress_t *address); +static inline lhnetaddresstype_t LHNETADDRESS_GetAddressType(const lhnetaddress_t *address) +{ + if (address) + return address->addresstype; + else + return LHNETADDRESSTYPE_NONE; +} const char *LHNETADDRESS_GetInterfaceName(const lhnetaddress_t *address, char *ifname, size_t ifnamelength); int LHNETADDRESS_GetPort(const lhnetaddress_t *address); int LHNETADDRESS_SetPort(lhnetaddress_t *address, int port); @@ -34,12 +43,14 @@ typedef struct lhnetsocket_s { lhnetaddress_t address; int inetsocket; - struct lhnetsocket_s *next, *prev; + llist_t list; } lhnetsocket_t; +extern lhnetsocket_t lhnet_socketlist; void LHNET_Init(void); void LHNET_Shutdown(void); +int LHNET_DefaultDSCP(int dscp); // < 0: query; >= 0: set (returns previous value) void LHNET_SleepUntilPacket_Microseconds(int microseconds); lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address); void LHNET_CloseSocket(lhnetsocket_t *lhnetsocket);