nxt_sockaddr.h (358:40bbd4c2349d) nxt_sockaddr.h (703:2d536dde84d2)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_SOCKADDR_H_INCLUDED_
8#define _NXT_SOCKADDR_H_INCLUDED_

--- 85 unchanged lines hidden (view full) ---

94NXT_EXPORT void nxt_job_sockaddr_parse(nxt_job_sockaddr_parse_t *jbs);
95NXT_EXPORT in_addr_t nxt_inet_addr(u_char *buf, size_t len);
96#if (NXT_INET6)
97NXT_EXPORT nxt_int_t nxt_inet6_addr(struct in6_addr *in6_addr, u_char *buf,
98 size_t len);
99#endif
100
101
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_SOCKADDR_H_INCLUDED_
8#define _NXT_SOCKADDR_H_INCLUDED_

--- 85 unchanged lines hidden (view full) ---

94NXT_EXPORT void nxt_job_sockaddr_parse(nxt_job_sockaddr_parse_t *jbs);
95NXT_EXPORT in_addr_t nxt_inet_addr(u_char *buf, size_t len);
96#if (NXT_INET6)
97NXT_EXPORT nxt_int_t nxt_inet6_addr(struct in6_addr *in6_addr, u_char *buf,
98 size_t len);
99#endif
100
101
102#define NXT_INET_ADDR_STR_LEN (sizeof("255.255.255.255:65535") - 1)
102#define NXT_INET_ADDR_STR_LEN nxt_length("255.255.255.255:65535")
103
104#define NXT_INET6_ADDR_STR_LEN \
103
104#define NXT_INET6_ADDR_STR_LEN \
105 (sizeof("[ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535") - 1)
105 nxt_length("[ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535")
106
107
108#define nxt_sockaddr_size(sa) \
109 (offsetof(nxt_sockaddr_t, u) + sa->socklen + sa->length)
110#define nxt_sockaddr_start(sa) nxt_pointer_to(sa, (sa)->start)
111#define nxt_sockaddr_address(sa) nxt_pointer_to(sa, (sa)->address_start)
112#define nxt_sockaddr_port(sa) nxt_pointer_to(sa, (sa)->port_start)
113#define nxt_sockaddr_port_length(sa) \
114 (((sa)->start + (sa)->length) - (sa)->port_start)
115
116
117#endif /* _NXT_SOCKADDR_H_INCLUDED_ */
106
107
108#define nxt_sockaddr_size(sa) \
109 (offsetof(nxt_sockaddr_t, u) + sa->socklen + sa->length)
110#define nxt_sockaddr_start(sa) nxt_pointer_to(sa, (sa)->start)
111#define nxt_sockaddr_address(sa) nxt_pointer_to(sa, (sa)->address_start)
112#define nxt_sockaddr_port(sa) nxt_pointer_to(sa, (sa)->port_start)
113#define nxt_sockaddr_port_length(sa) \
114 (((sa)->start + (sa)->length) - (sa)->port_start)
115
116
117#endif /* _NXT_SOCKADDR_H_INCLUDED_ */