| version 1.3 | | version 1.4 |
|---|
| | |
| /* Dump raw form of IP address/port by fancy output to user | | /* Dump raw form of IP address/port by fancy output to user |
| */ | | */ |
| | | |
| #ifdef UDPDEBUG | | //define UDPDEBUG_HS to print debug messages about handshaking |
| | | //#define UDPDEBUG_HS |
| | | //define UDPDEBUG to print general udp debug messages (spammish) |
| | | //#define UDPDEBUG |
| | | #if defined(UDPDEBUG) || defined(UDPDEBUG_HS) |
| #include <stdio.h> | | #include <stdio.h> |
| inline char *ip_hs_statetoa(int state){ | | inline char *ip_hs_statetoa(int state){ |
| if (!state) | | if (!state) |
| | |
| bool operator == (const ip_id &a_id)const {return memcmp(id,a_id.id,6)==0;} | | bool operator == (const ip_id &a_id)const {return memcmp(id,a_id.id,6)==0;} |
| bool operator > (const ip_id &a_id)const {return memcmp(id,a_id.id,6)>0;} | | bool operator > (const ip_id &a_id)const {return memcmp(id,a_id.id,6)>0;} |
| ip_id& operator = (const ip_id &a_id){readbuf(a_id.id);return *this;} | | ip_id& operator = (const ip_id &a_id){readbuf(a_id.id);return *this;} |
| #ifdef UDPDEBUG | | #if defined(UDPDEBUG) || defined(UDPDEBUG_HS) |
| void dump(void){dumprid(id);} | | void dump(void){dumprid(id);} |
| #endif | | #endif |
| ip_id(ubyte*nid){readbuf(nid);} | | ip_id(ubyte*nid){readbuf(nid);} |
| | |
| return memcmp(addr,a_addr.addr,alen)>0; | | return memcmp(addr,a_addr.addr,alen)>0; |
| } | | } |
| ip_addr& operator = (const ip_addr &a_addr){alen=a_addr.alen;memcpy(addr,a_addr.addr,6);return *this;} | | ip_addr& operator = (const ip_addr &a_addr){alen=a_addr.alen;memcpy(addr,a_addr.addr,6);return *this;} |
| #ifdef UDPDEBUG | | #if defined(UDPDEBUG) || defined(UDPDEBUG_HS) |
| void dump(void)const{dumpraddr(addr);} | | void dump(void)const{dumpraddr(addr);} |
| #endif | | #endif |
| void set(int addrsize,ubyte *naddr,ushort port){ | | void set(int addrsize,ubyte *naddr,ushort port){ |