MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / su2ip_addr

Function su2ip_addr

ip_addr.h:332–350  ·  view source on GitHub ↗

! \brief inits an ip_addr pointer from a sockaddr_union ip address */

Source from the content-addressed store, hash-verified

330
331/*! \brief inits an ip_addr pointer from a sockaddr_union ip address */
332static inline void su2ip_addr(struct ip_addr* ip, const union sockaddr_union* su)
333{
334 switch(su->s.sa_family){
335 case AF_INET:
336 ip->af=AF_INET;
337 ip->len=4;
338 memcpy(ip->u.addr, &su->sin.sin_addr, 4);
339 break;
340 case AF_INET6:
341 ip->af=AF_INET6;
342 ip->len=16;
343 memcpy(ip->u.addr, &su->sin6.sin6_addr, 16);
344 break;
345 default:
346 LM_CRIT("Unknown address family %d\n", su->s.sa_family);
347 ip->af=0;
348 ip->len=0;
349 }
350}
351
352
353/*! \brief ip_addr2su -> the same as \ref init_su() */

Callers 15

get_out_socketFunction · 0.85
check_blacklistsFunction · 0.85
proto_wss_sendFunction · 0.85
proto_sctp_readFunction · 0.85
add_dest2listFunction · 0.85
add_lb_dsturiFunction · 0.85
proto_tls_sendFunction · 0.85
proto_ws_sendFunction · 0.85
trace_slreply_outFunction · 0.85
trace_msg_outFunction · 0.85
trace_onreply_outFunction · 0.85
raw_capture_rcv_loopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected