From 88a5d0cdda513357496b9d53878618e1620f47e8 Mon Sep 17 00:00:00 2001 From: ultramage Date: Thu, 5 Apr 2007 18:49:57 +0000 Subject: * Made a crazy attempt to at least partially synchronize login&char code * Major edit to the way the servers handle ip addresses, making them obey the "host byte order inside, network byte order outside" rule - hopefully covered all entry- and exit-points for IP address data - discovered several places where Gravity's client breaks the convention, will need to come up with a suitable countermeasure for that - other than that, the code should be portable, except for printing and ipban mask testing (those still assume a specific byte order) - tested both txt and sql in all usual situations; tested single- and multi-server setups, all seems to work (but watch out for hidden bugs!) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10162 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/socket.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/common/socket.h') diff --git a/src/common/socket.h b/src/common/socket.h index b7b8ce839..ba984eb3a 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -81,7 +81,7 @@ struct socket_data { size_t rdata_size, wdata_size; size_t rdata_pos; time_t rdata_tick; // time of last receive (for detecting timeouts) - struct sockaddr_in client_addr; // remote client address (zero for s2s connections) + uint32 client_addr; // remote client address (zero for s2s connections) void* session_data; RecvFunc func_recv; SendFunc func_send; @@ -106,12 +106,12 @@ extern int session_isActive(int fd); // Function prototype declaration -int make_listen_bind(long,int); -int make_connection(long,int); -int realloc_fifo(int fd,unsigned int rfifo_size,unsigned int wfifo_size); +int make_listen_bind(uint32 ip, uint16 port); +int make_connection(uint32 ip, uint16 port); +int realloc_fifo(int fd, unsigned int rfifo_size, unsigned int wfifo_size); int realloc_writefifo(int fd, size_t addition); -int WFIFOSET(int fd,int len); -int RFIFOSKIP(int fd,int len); +int WFIFOSET(int fd, int len); +int RFIFOSKIP(int fd, int len); int do_sendrecv(int next); int do_parsepacket(void); @@ -126,9 +126,9 @@ extern void set_nonblocking(int fd, int yes); void set_defaultparse(ParseFunc defaultparse); // hostname/ip conversion functions -in_addr_t host2ip(const char* hostname); -const char* ip2str(in_addr_t ip, char ip_str[16]); - +uint32 host2ip(const char* hostname); +const char* ip2str(uint32 ip, char ip_str[16]); +#define CONVIP(ip) (ip>>24)&0xFF,(ip>>16)&0xFF,(ip>>8)&0xFF,(ip>>0)&0xFF int socket_getips(uint32* ips, int max); -- cgit v1.2.3-60-g2f50