X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=lhnet.h;h=d46dbe99a859cfb6db3a2ad8ed095febcd79073c;hb=c75400b916bb58292186fd6a17a3fb3a720bd3f9;hp=e4224c76372e272db1c77f7c087374f979bdf61e;hpb=3b30f1697366dcf485232953b44b51b2eaf3e69f;p=xonotic%2Fdarkplaces.git diff --git a/lhnet.h b/lhnet.h index e4224c76..d46dbe99 100644 --- a/lhnet.h +++ b/lhnet.h @@ -4,23 +4,28 @@ #ifndef LHNET_H #define LHNET_H -#define LHNETADDRESSTYPE_NONE 0 -#define LHNETADDRESSTYPE_LOOP 1 -#define LHNETADDRESSTYPE_INET4 2 -#define LHNETADDRESSTYPE_INET6 3 +typedef enum lhnetaddresstype_e +{ + LHNETADDRESSTYPE_NONE, + LHNETADDRESSTYPE_LOOP, + LHNETADDRESSTYPE_INET4, + LHNETADDRESSTYPE_INET6 +} +lhnetaddresstype_t; typedef struct lhnetaddress_s { - int addresstype; + lhnetaddresstype_t addresstype; int port; // used by LHNETADDRESSTYPE_LOOP unsigned char storage[256]; // sockaddr_in or sockaddr_in6 } lhnetaddress_t; -int LHNETADDRESS_FromPort(lhnetaddress_t *address, int addresstype, int port); +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); +const char *LHNETADDRESS_GetInterfaceName(const lhnetaddress_t *address); int LHNETADDRESS_GetPort(const lhnetaddress_t *address); int LHNETADDRESS_SetPort(lhnetaddress_t *address, int port); int LHNETADDRESS_Compare(const lhnetaddress_t *address1, const lhnetaddress_t *address2);