Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 8, 2010, 4:08:09 AM (14 years ago)
Author:
adrfried
Message:

using two separate sockets for ipv4 and ipv6

File:
1 edited

Legend:

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

    r7330 r7377  
    5151   ENET_SOCKOPT_RCVBUF    = 3,
    5252   ENET_SOCKOPT_SNDBUF    = 4,
    53    ENET_SOCKOPT_REUSEADDR = 5,
    54    ENET_SOCKOPT_V6ONLY = 6
     53   ENET_SOCKOPT_REUSEADDR = 5
    5554} ENetSocketOption;
    5655
     
    6059} ENetHostAddress;
    6160
    62 extern const ENetHostAddress ENET_HOST_ANY;       /**< specifies the default server host */
    63 extern 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 */
     61extern const ENetHostAddress ENET_HOST_ANY;          /**< specifies the default server host */
     62extern const ENetHostAddress ENET_IPV4MAPPED_PREFIX; /**< specifies the IPv4-mapped IPv6 prefix */
     63extern const ENetHostAddress ENET_HOST_BROADCAST;    /**< specifies a IPv4 subnet-wide broadcast */
     64#define ENET_IPV4MAPPED_PREFIX_LEN 12                /**< specifies the length of the IPv4-mapped IPv6 prefix */
     65#define ENET_PORT_ANY 0                              /**< specifies that a port should be automatically chosen */
    6566
    6667/**
     
    8081   enet_uint16 port;
    8182} ENetAddress;
     83
     84/**
     85 * The address family type.
     86 */
     87typedef enum _ENetAddressFamily
     88{
     89    ENET_NO_ADDRESS_FAMILY = 0,
     90    ENET_IPV4 = 1,
     91    ENET_IPV6 = 2
     92} ENetAddressFamily;
    8293
    8394/**
     
    325336typedef struct _ENetHost
    326337{
    327    ENetSocket           socket;
     338   ENetSocket           socket4;
     339   ENetSocket           socket6;
    328340   ENetAddress          address;                     /**< Internet address of the host */
    329341   enet_uint32          incomingBandwidth;           /**< downstream bandwidth of the host */
     
    445457    @{
    446458*/
    447 ENET_API ENetSocket enet_socket_create (ENetSocketType);
    448 ENET_API int        enet_socket_bind (ENetSocket, const ENetAddress *);
     459ENET_API ENetSocket enet_socket_create (ENetSocketType, ENetAddressFamily);
     460ENET_API int        enet_socket_bind (ENetSocket, const ENetAddress *, ENetAddressFamily);
    449461ENET_API int        enet_socket_listen (ENetSocket, int);
    450 ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
    451 ENET_API int        enet_socket_connect (ENetSocket, const ENetAddress *);
    452 ENET_API int        enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
    453 ENET_API int        enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
    454 ENET_API int        enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
     462ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *, ENetAddressFamily);
     463ENET_API int        enet_socket_connect (ENetSocket, const ENetAddress *, ENetAddressFamily);
     464ENET_API int        enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t, ENetAddressFamily);
     465ENET_API int        enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t, ENetAddressFamily);
     466ENET_API int        enet_socket_wait (ENetSocket, ENetSocket, enet_uint32 *, enet_uint32);
    455467ENET_API int        enet_socket_set_option (ENetSocket, ENetSocketOption, int);
    456468ENET_API void       enet_socket_destroy (ENetSocket);
     
    496508    @returns the IPv4-mapped IPv6 address in network byte order
    497509*/
    498 static 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 }
     510ENET_API ENetHostAddress enet_address_map4 (enet_uint32 address);
     511
     512/** Returns the Address family of an (IPv4-mapped) IPv6 address.
     513    @param address IPv6 address
     514    @returns address family
     515*/
     516ENET_API ENetAddressFamily enet_get_address_family (const ENetAddress * address);
    505517
    506518/** @} */
Note: See TracChangeset for help on using the changeset viewer.