3 * Copyright (C) Igor Sysoev
7 #ifndef _NGX_INET_H_INCLUDED_
8 #define _NGX_INET_H_INCLUDED_
11 #include <ngx_config.h>
15 #define NGX_INET_ADDRSTRLEN (sizeof("255.255.255.255") - 1)
16 #define NGX_INET6_ADDRSTRLEN \
17 (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") - 1)
19 #define NGX_SOCKADDR_STRLEN (NGX_INET6_ADDRSTRLEN + sizeof(":65535") - 1)
23 * TODO: autoconfigure NGX_SOCKADDRLEN as
24 * sizeof(struct sockaddr_storage)
25 * sizeof(struct sockaddr_in6)
26 * sizeof(struct sockaddr_in)
30 #define NGX_SOCKADDRLEN sizeof(struct sockaddr_in6)
32 #define NGX_SOCKADDRLEN sizeof(struct sockaddr_in)
48 struct sockaddr
*sockaddr
;
61 in_port_t default_port
;
66 unsigned no_resolve
:1;
75 u_char sockaddr
[NGX_SOCKADDRLEN
];
77 ngx_peer_addr_t
*addrs
;
84 in_addr_t
ngx_inet_addr(u_char
*text
, size_t len
);
85 size_t ngx_sock_ntop(struct sockaddr
*sa
, u_char
*text
, size_t len
,
87 size_t ngx_inet_ntop(int family
, void *addr
, u_char
*text
, size_t len
);
88 ngx_int_t
ngx_ptocidr(ngx_str_t
*text
, void *cidr
);
89 ngx_int_t
ngx_parse_url(ngx_pool_t
*pool
, ngx_url_t
*u
);
90 ngx_int_t
ngx_inet_resolve_host(ngx_pool_t
*pool
, ngx_url_t
*u
);
94 #endif /* _NGX_INET_H_INCLUDED_ */