42#include <sys/socket.h>
43#include <netinet/in.h>
58 struct in6_addr src_ip;
69 memset(&src_ip, 0,
sizeof(src_ip));
71#ifndef PCP_USE_IPV6_SOCKET
73 if (s->
af == AF_INET) {
85 "Error (%s) occurred while registering a new "
94 s->
src_ip[2]=htonl(0xFFFF);
98 "IPv6 is disabled and IPv6 address of PCP server occurred");
105 if (s->
af == AF_INET) {
118 "Error (%s) occurred while registering a new "
139 struct sockaddr_in6 *gws=NULL, *gw;
144 for (; rcount > 0; rcount--, gw++) {
147 if ((IN6_IS_ADDR_V4MAPPED(&gw->sin6_addr)) && (
S6_ADDR32(&gw->sin6_addr)[3] == INADDR_ANY))
150 if (IN6_IS_ADDR_UNSPECIFIED(&gw->sin6_addr))
157 if (pcps_indx >= 0) {
162 if (psd_fill_pcp_server_src(s)) {
164 "Failed to initialize gateway %s as a PCP server.",
168 "Added as possible PCP server.",
179 struct in6_addr pcp_ip=IN6ADDR_ANY_INIT;
186 if (sa->sa_family == AF_INET) {
190 S6_ADDR32(&pcp_ip)[3]=((
struct sockaddr_in *)sa)->sin_addr.s_addr;
191 pcp_port=((
struct sockaddr_in *)sa)->sin_port;
194 pcp_port=((
struct sockaddr_in6 *)sa)->sin6_port;
195 scope_id=((
struct sockaddr_in6 *)sa)->sin6_scope_id;
206 if (pcps_indx >= 0) {
222 if (psd_fill_pcp_server_src(pcps)) {
const char * findsaddr6(const struct sockaddr_in6 *to, struct in6_addr *from)
const char * findsaddr(const struct sockaddr_in *to, struct in6_addr *from)
int getgateways(struct sockaddr_in6 **gws)
pcp_server_t * get_pcp_server(pcp_ctx_t *ctx, int pcp_server_index)
pcp_server_t * get_pcp_server_by_ip(pcp_ctx_t *ctx, struct in6_addr *ip)
int pcp_new_server(pcp_ctx_t *ctx, struct in6_addr *ip, uint16_t port, uint32_t scope_id)
#define PCP_LOG_END(level)
#define PCP_LOG_BEGIN(level)
#define PCP_LOG(level, fmt,...)
pcp_errno psd_add_pcp_server(pcp_ctx_t *ctx, struct sockaddr *sa, uint8_t version)
void psd_add_gws(pcp_ctx_t *ctx)
void pcp_fill_sockaddr(struct sockaddr *dst, struct in6_addr *sip, uint16_t sport, int ret_ipv6_mapped_ipv4, uint32_t scope_id)
#define IPV6_ADDR_COPY(dest, src)
struct timeval next_timeout
struct sockaddr_storage pcp_server_saddr
pcp_server_state_e server_state
char pcp_server_paddr[INET6_ADDRSTRLEN]