Rev 4257 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4257 | Rev 4282 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include |
1 | #include |
Line 2... | Line -... | ||
2 | - | ||
3 | - | ||
4 | unsigned long inet_addr(char *cp) |
- | |
5 | { |
- | |
6 | // Adapted from here http://stackoverflow.com/a/1684635 |
- | |
7 | unsigned long __ret; |
- | |
8 | unsigned int c1,c2,c3,c4; |
- | |
9 | sscanf(cp, "%d.%d.%d.%d", &c1,&c2,&c3,&c4); |
- | |
10 | __ret = (unsigned long)c4+c3*256+c2*256*256+c1*256*256*256; |
- | |
11 | return htonl(__ret); |
- | |
12 | } |
2 | |
13 | 3 | ||
14 | int socket(int domain, int type, int protocol) |
4 | int socket(int domain, int type, int protocol) |
15 | { |
5 | { |
16 | int __ret; |
6 | int __ret; |
Line 45... | Line 35... | ||
45 | int __ret; |
35 | int __ret; |
46 | __asm__("int $0x40":"=a"(__ret):"a"(_SOCKETF),"b"(_RECEIVESF),"c"(sockfd),"d"(buf),"S"(len),"D"(flags)); |
36 | __asm__("int $0x40":"=a"(__ret):"a"(_SOCKETF),"b"(_RECEIVESF),"c"(sockfd),"d"(buf),"S"(len),"D"(flags)); |
47 | return __ret; |
37 | return __ret; |
48 | } |
38 | } |
Line -... | Line 39... | ||
- | 39 | ||
- | 40 | ||
- | 41 | ||
- | 42 | ||
49 | 43 | ||
Line 50... | Line 44... | ||
50 | // -------------------------------------------------------------- |
44 | // -------------------------------------------------------------- |
51 | 45 | ||
52 | __u32 __menuet__open_UDP_socket(__u32 local_port,__u32 remote_port,__u32 remote_ip) |
46 | __u32 __menuet__open_UDP_socket(__u32 local_port,__u32 remote_port,__u32 remote_ip) |