Go to the source code of this file.
◆ INADDR_ANY
◆ INADDR_NONE
◆ ISALNUM
#define ISALNUM |
( |
|
c | ) |
( (((c) >= 'A') && ((c) <= 'Z')) || (((c) >= 'a') && ((c) <= 'z')) || (((c) >= '0') && ((c) <= '9')) ) |
◆ AddrStrToAddr()
Definition at line 54 of file StrAddr.c.
55{
56 char portstr[128];
57 unsigned long ipnum;
60 char *hostcp, *atsign, *colon, *
cp, *p2;
61
63 strncpy(portstr,
s,
sizeof(portstr));
64 portstr[sizeof(portstr) - 1] = '\0';
65
67
68 if ((colon[1] == '/') && (colon[2] == '/')) {
69 *colon = '\0';
71 hostcp = colon + 3;
72 for (
cp = hostcp; *
cp !=
'\0';
cp++) {
74
82 }
84 break;
85 }
86 }
89 } else {
90
91 *colon = '\0';
92 hostcp = portstr;
94 }
95 }
else if ((atsign =
strchr(portstr,
'@')) !=
NULL) {
96
97 *atsign = '\0';
98 hostcp = atsign + 1;
100 } else if (defaultport > 0) {
101
102 port = (
unsigned int) defaultport;
103 hostcp = portstr;
104 } else {
105
106
107
110 }
111
113
117 sa->sin_addr.s_addr = ipnum;
118 } else {
125 }
129 }
130 return (0);
131}
static unsigned int ServiceNameToPortNumber(const char *const s)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
static struct sockaddr_in sa
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define memcpy(s1, s2, n)
#define kAddrStrToAddrBadHost
#define kAddrStrToAddrMiscErr
Referenced by SConnectByName(), SendtoByName(), and SSendtoByName().
◆ AddrToAddrStr()
Definition at line 136 of file StrAddr.c.
137{
138 const char *addrNamePtr;
141 char *dlim, *dp;
144
145 if (dns == 0) {
147 } else {
151 } else {
153 }
154 }
157 for (dp =
dst, dlim = dp + dsize - 1; ;
fmt++) {
159 break;
160 }
else if (*
fmt ==
'%') {
163 if (dp < dlim)
164 *dp++ = '%';
165 }
else if (*
fmt ==
'p') {
168 if (dp < dlim)
170 *dp = '\0';
171 }
else if (*
fmt ==
'h') {
172 if (addrNamePtr !=
NULL) {
174 } else {
176 }
177 for ( ; *
cp !=
'\0';
cp++)
178 if (dp < dlim)
180 *dp = '\0';
181 }
else if (*
fmt ==
's') {
188 } else {
190 }
191 for ( ; *
cp !=
'\0';
cp++)
192 if (dp < dlim)
194
195 *dp = '\0';
196 }
else if ((*
fmt ==
't') || (*
fmt ==
'u')) {
201 } else {
203 }
204 for ( ; *
cp !=
'\0';
cp++)
205 if (dp < dlim)
207
208 *dp = '\0';
209 }
else if (*
fmt ==
'\0') {
210 break;
211 } else {
212 if (dp < dlim)
214 }
215 } else if (dp < dlim) {
217 }
218 }
219 *dp = '\0';
221}
PSERVENT WSAAPI getservbyport(IN int port, IN const char FAR *proto)
PHOSTENT WSAAPI gethostbyaddr(IN const char FAR *addr, IN int len, IN int type)
#define sprintf(buf, format,...)
Referenced by ServeOneClient().
◆ ServiceNameToPortNumber()
Definition at line 15 of file StrAddr.c.
16{
20
22 str[
sizeof(
str) - 1] =
'\0';
29 }
33 break;
34 }
36
39
40 return ((
unsigned int)
ntohs((
unsigned short)
sp->s_port));
41 }
44
45 return ((
unsigned int)
ntohs((
unsigned short)
sp->s_port));
46 }
47 return (0);
48}
PSERVENT WSAAPI getservbyname(IN const char FAR *name, IN const char FAR *proto)
Referenced by AddrStrToAddr().