Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 3, 2010, 12:28:21 AM (14 years ago)
Author:
adrfried
Message:

patch libenet to support ipv6

This is only done for Linux so far.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ipv6/src/external/enet/include/enet/enet.h

    r7328 r7330  
    5151   ENET_SOCKOPT_RCVBUF    = 3,
    5252   ENET_SOCKOPT_SNDBUF    = 4,
    53    ENET_SOCKOPT_REUSEADDR = 5
     53   ENET_SOCKOPT_REUSEADDR = 5,
     54   ENET_SOCKOPT_V6ONLY = 6
    5455} ENetSocketOption;
    5556
    56 enum
    57 {
    58    ENET_HOST_ANY       = 0,            /**< specifies the default server host */
    59    ENET_HOST_BROADCAST = 0xFFFFFFFF,   /**< specifies a subnet-wide broadcast */
    60 
    61    ENET_PORT_ANY       = 0             /**< specifies that a port should be automatically chosen */
    62 };
     57typedef struct _ENetHostAddress
     58{
     59   enet_uint8 addr[16];
     60} ENetHostAddress;
     61
     62extern const ENetHostAddress ENET_HOST_ANY;       /**< specifies the default server host */
     63extern const ENetHostAddress ENET_HOST_BROADCAST; /**< specifies a IPv4 subnet-wide broadcast */
     64#define ENET_PORT_ANY 0                           /**< specifies that a port should be automatically chosen */
    6365
    6466/**
     
    7476typedef struct _ENetAddress
    7577{
    76    enet_uint32 host;
     78   ENetHostAddress host;
     79   enet_uint32 scopeID; //FIXME: this is of different size on Windows
    7780   enet_uint16 port;
    7881} ENetAddress;
     
    489492ENET_API int enet_address_get_host (const ENetAddress * address, char * hostName, size_t nameLength);
    490493
     494/** Maps an IPv4 Address to an IPv6 address.
     495    @param address IPv4 address in network byte order
     496    @returns the IPv4-mapped IPv6 address in network byte order
     497*/
     498static inline ENetHostAddress enet_address_map4 (enet_uint32 address)
     499{
     500   ENetHostAddress addr = ENET_HOST_ANY;
     501   ((enet_uint16 *)addr.addr)[5] = 0xffff;
     502   ((enet_uint32 *)addr.addr)[3] = address;
     503   return addr;
     504}
     505
    491506/** @} */
    492507
Note: See TracChangeset for help on using the changeset viewer.