This source file includes following definitions.
- in_ntoa
- in_aton
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include <asm/segment.h>
25 #include <asm/system.h>
26 #include <linux/types.h>
27 #include <linux/kernel.h>
28 #include <linux/sched.h>
29 #include <linux/string.h>
30 #include <linux/mm.h>
31 #include <linux/socket.h>
32 #include <linux/in.h>
33 #include <linux/errno.h>
34 #include <linux/stat.h>
35 #include <stdarg.h>
36 #include <linux/inet.h>
37 #include <linux/netdevice.h>
38 #include <linux/etherdevice.h>
39 #include "ip.h"
40 #include "protocol.h"
41 #include "tcp.h"
42 #include <linux/skbuff.h>
43
44
45
46
47
48
49 char *in_ntoa(unsigned long in)
50 {
51 static char buff[18];
52 char *p;
53
54 p = (char *) ∈
55 sprintf(buff, "%d.%d.%d.%d",
56 (p[0] & 255), (p[1] & 255), (p[2] & 255), (p[3] & 255));
57 return(buff);
58 }
59
60
61
62
63
64
65 unsigned long in_aton(char *str)
66 {
67 unsigned long l;
68 unsigned int val;
69 int i;
70
71 l = 0;
72 for (i = 0; i < 4; i++)
73 {
74 l <<= 8;
75 if (*str != '\0')
76 {
77 val = 0;
78 while (*str != '\0' && *str != '.')
79 {
80 val *= 10;
81 val += *str - '0';
82 str++;
83 }
84 l |= val;
85 if (*str != '\0')
86 str++;
87 }
88 }
89 return(htonl(l));
90 }
91