mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 06:25:59 -07:00
*** empty log message ***
This commit is contained in:
parent
df636cc8f7
commit
92f904f56a
6 changed files with 46 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
|||
AC_INIT(libenet, 10-2-2006)
|
||||
AM_INIT_AUTOMAKE(libenet.a, 10-2-2006)
|
||||
AC_INIT(libenet, 12-12-2006)
|
||||
AM_INIT_AUTOMAKE(libenet.a, 12-12-2006)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_RANLIB
|
||||
|
|
|
@ -183,7 +183,7 @@ enum
|
|||
ENET_PEER_TIMEOUT_MINIMUM = 5000,
|
||||
ENET_PEER_TIMEOUT_MAXIMUM = 30000,
|
||||
ENET_PEER_PING_INTERVAL = 500,
|
||||
ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 4 * 32,
|
||||
ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 4 * 32
|
||||
};
|
||||
|
||||
typedef struct _ENetChannel
|
||||
|
@ -396,7 +396,17 @@ ENET_API void enet_socket_destroy (ENetSocket);
|
|||
*/
|
||||
ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName);
|
||||
|
||||
/** Attempts to do a reserve lookup of the host field in the address parameter.
|
||||
/** Gives the printable form of the ip address specified in the address parameter.
|
||||
@param address address printed
|
||||
@param hostName destination for name, must not be NULL
|
||||
@param nameLength maximum length of hostName.
|
||||
@returns the null-terminated name of the host in hostName on success
|
||||
@retval 0 on success
|
||||
@retval < 0 on failure
|
||||
*/
|
||||
ENET_API int enet_address_get_host_ip (const ENetAddress * address, char * hostName, size_t nameLength);
|
||||
|
||||
/** Attempts to do a reverse lookup of the host field in the address parameter.
|
||||
@param address address used for reverse lookup
|
||||
@param hostName destination for name, must not be NULL
|
||||
@param nameLength maximum length of hostName.
|
||||
|
|
|
@ -16,7 +16,7 @@ enum
|
|||
ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768,
|
||||
ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1,
|
||||
ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255,
|
||||
ENET_PROTOCOL_MAXIMUM_PEER_ID = 0x7FFF,
|
||||
ENET_PROTOCOL_MAXIMUM_PEER_ID = 0x7FFF
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
@ -35,7 +35,7 @@ typedef enum
|
|||
ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
|
||||
ENET_PROTOCOL_COMMAND_COUNT = 12,
|
||||
|
||||
ENET_PROTOCOL_COMMAND_MASK = 0x0F,
|
||||
ENET_PROTOCOL_COMMAND_MASK = 0x0F
|
||||
} ENetProtocolCommand;
|
||||
|
||||
typedef enum
|
||||
|
@ -44,7 +44,7 @@ typedef enum
|
|||
ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
|
||||
|
||||
ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15),
|
||||
ENET_PROTOCOL_HEADER_FLAG_MASK = 0x8000,
|
||||
ENET_PROTOCOL_HEADER_FLAG_MASK = 0x8000
|
||||
} ENetProtocolFlag;
|
||||
|
||||
typedef struct
|
||||
|
|
6
peer.c
6
peer.c
|
@ -116,7 +116,8 @@ enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet)
|
|||
fragmentNumber,
|
||||
fragmentOffset;
|
||||
|
||||
packet -> flags = ENET_PACKET_FLAG_RELIABLE;
|
||||
packet -> flags |= ENET_PACKET_FLAG_RELIABLE;
|
||||
packet -> flags &= ~ENET_PACKET_FLAG_UNSEQUENCED;
|
||||
|
||||
for (fragmentNumber = 0,
|
||||
fragmentOffset = 0;
|
||||
|
@ -311,9 +312,6 @@ enet_peer_reset (ENetPeer * peer)
|
|||
peer -> outgoingPeerID = ENET_PROTOCOL_MAXIMUM_PEER_ID;
|
||||
peer -> sessionID = 0;
|
||||
|
||||
peer -> address.host = ENET_HOST_ANY;
|
||||
peer -> address.port = 0;
|
||||
|
||||
peer -> state = ENET_PEER_STATE_DISCONNECTED;
|
||||
|
||||
peer -> incomingBandwidth = 0;
|
||||
|
|
28
unix.c
28
unix.c
|
@ -106,6 +106,21 @@ enet_address_set_host (ENetAddress * address, const char * name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength)
|
||||
{
|
||||
#ifdef HAS_INET_NTOP
|
||||
if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL)
|
||||
#else
|
||||
char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
|
||||
if (addr != NULL)
|
||||
strncpy (name, addr, nameLength);
|
||||
else
|
||||
#endif
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength)
|
||||
{
|
||||
|
@ -130,18 +145,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng
|
|||
#endif
|
||||
|
||||
if (hostEntry == NULL)
|
||||
{
|
||||
#ifdef HAS_INET_NTOP
|
||||
if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL)
|
||||
#else
|
||||
char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
|
||||
if (addr != NULL)
|
||||
strncpy (name, addr, nameLength);
|
||||
else
|
||||
#endif
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
return enet_address_get_host_ip (address, name, nameLength);
|
||||
|
||||
strncpy (name, hostEntry -> h_name, nameLength);
|
||||
|
||||
|
|
18
win32.c
18
win32.c
|
@ -73,6 +73,16 @@ enet_address_set_host (ENetAddress * address, const char * name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength)
|
||||
{
|
||||
char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
|
||||
if (addr == NULL)
|
||||
return -1;
|
||||
strncpy (name, addr, nameLength);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength)
|
||||
{
|
||||
|
@ -83,13 +93,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng
|
|||
|
||||
hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET);
|
||||
if (hostEntry == NULL)
|
||||
{
|
||||
char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
|
||||
if (addr == NULL)
|
||||
return -1;
|
||||
strncpy (name, addr, nameLength);
|
||||
return 0;
|
||||
}
|
||||
return enet_address_get_host_ip (address, name, nameLength);
|
||||
|
||||
strncpy (name, hostEntry -> h_name, nameLength);
|
||||
|
||||
|
|
Loading…
Reference in a new issue