X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=lhnet.h;h=764e361aefeaa9b1d8e17fcc3ca17b6107552ea5;hp=6d1d1f3f22c08f661d3c4ef40dc8da454f682e3a;hb=HEAD;hpb=4d34e0a632cbc401712f46e10bb9864438b0881f diff --git a/lhnet.h b/lhnet.h index 6d1d1f3f..d368940d 100644 --- a/lhnet.h +++ b/lhnet.h @@ -26,8 +26,15 @@ lhnetaddress_t; int LHNETADDRESS_FromPort(lhnetaddress_t *address, lhnetaddresstype_t addresstype, int port); int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int defaultport); +/// Returns the number of bytes written to *string excluding the \0 terminator. 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); @@ -40,6 +47,7 @@ typedef struct lhnetsocket_s llist_t list; } lhnetsocket_t; +extern lhnetsocket_t lhnet_socketlist; void LHNET_Init(void); void LHNET_Shutdown(void);