[Javanetsim-cvs] IceScan/icesockets csocket.h, 1.6, 1.7 sock_types.h, 1.4, 1.5
Status: Beta
Brought to you by:
darkkey
|
From: Alexander B. <da...@us...> - 2006-12-13 14:15:35
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14219/icesockets Modified Files: csocket.h sock_types.h Log Message: no message Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sock_types.h 13 Dec 2006 13:22:00 -0000 1.4 --- sock_types.h 13 Dec 2006 14:15:21 -0000 1.5 *************** *** 153,156 **** --- 153,181 ---- #endif + + + // IP Header structure for cygwin + #ifdef __CYGWIN__ + struct pkt_iphdr{ + #if __BYTE_ORDER == __LITTLE_ENDIAN + my_uint8_t ihl:4; + my_uint8_t version:4; + #elif __BYTE_ORDER == __BIG_ENDIAN + my_uint8_t version:4; + my_uint8_t ihl:4; + #else + #error "Couldn't determine endianness" + #endif + my_uint8_t tos; + my_uint16_t tot_len; + my_uint16_t id; + my_uint16_t frag_off; + my_uint8_t ttl; + my_uint8_t protocol; + my_uint16_t csum; + my_uint32_t saddr; + my_uint32_t daddr; + }; + #endif #endif Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** csocket.h 12 Dec 2006 20:40:19 -0000 1.6 --- csocket.h 13 Dec 2006 14:15:21 -0000 1.7 *************** *** 198,219 **** int sendto(const char *hostname, int port, const void *msg, int len, unsigned int flags){ ! struct addrinfo hints, *res; ! int salen; ! char cportbuf[8]; ! char *cport = cportbuf; ! if(port == 0) cport = NULL; ! else sprintf(cport, "%d", port); ! bzero(&hints, sizeof(struct addrinfo)); ! hints.ai_flags = AI_CANONNAME; ! hints.ai_family = domain; ! hints.ai_socktype = type; ! if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) ! return sockerror("getaddrinfo"); ! return ::sendto(sid, msg, len, flags, (const sockaddr *) res->ai_addr, res->ai_addrlen); } --- 198,224 ---- int sendto(const char *hostname, int port, const void *msg, int len, unsigned int flags){ ! struct sockaddr_in saddress; ! int slen; ! //struct addrinfo hints, *res; ! //int salen; ! //char cportbuf[8]; ! //char *cport = cportbuf; ! //if(port == 0) cport = NULL; ! //else sprintf(cport, "%d", port); ! //bzero(&hints, sizeof(struct addrinfo)); ! //hints.ai_flags = AI_CANONNAME; ! //hints.ai_family = domain; ! //hints.ai_socktype = type; ! if((slen == make_sockname(saddress, hostname, port, domain))) ! return sockerror("sockname"); ! //if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) ! // return sockerror("getaddrinfo"); ! //return ::sendto(sid, msg, len, flags, (const sockaddr *) res->ai_addr, res->ai_addrlen); ! return ::sendto(sid, msg, len, flags, (const sockaddr *) &saddress, slen); } |