Lines Matching refs:peer
45 struct sockaddr peer; member
181 msg.msg_name = &data->peer; in tx()
218 static int get_local_ipv6(struct net_if *iface, struct sockaddr *peer, in get_local_ipv6() argument
223 if (peer->sa_family != AF_INET6) { in get_local_ipv6()
227 addr = net_if_ipv6_select_src_addr(iface, &net_sin6(peer)->sin6_addr); in get_local_ipv6()
240 static int get_local_ipv4(struct net_if *iface, struct sockaddr *peer, in get_local_ipv4() argument
245 if (peer->sa_family != AF_INET) { in get_local_ipv4()
249 addr = net_if_ipv4_select_src_addr(iface, &net_sin(peer)->sin_addr); in get_local_ipv4()
262 static int create_socket(struct net_if *iface, struct sockaddr *peer) in create_socket() argument
295 sock = socket(peer->sa_family, SOCK_DGRAM, IPPROTO_UDP); in create_socket()
302 peer->sa_family == AF_INET6) { in create_socket()
303 ret = get_local_ipv6(iface, peer, &local, &addrlen); in create_socket()
311 peer->sa_family == AF_INET) { in create_socket()
312 ret = get_local_ipv4(iface, peer, &local, &addrlen); in create_socket()
320 LOG_ERR("Invalid socket family %d", peer->sa_family); in create_socket()
358 &peer_data.peer); in get_peer_address()
364 if (net_sin(&peer_data.peer)->sin_port == 0) { in get_peer_address()
365 net_sin(&peer_data.peer)->sin_port = htons(4242); in get_peer_address()
369 peer_data.peer.sa_family == AF_INET6) { in get_peer_address()
371 &net_sin6(&peer_data.peer)->sin6_addr); in get_peer_address()
373 net_addr_ntop(peer_data.peer.sa_family, in get_peer_address()
374 &net_sin6(&peer_data.peer)->sin6_addr, addr_str, in get_peer_address()
379 peer_data.peer.sa_family == AF_INET) { in get_peer_address()
381 &net_sin(&peer_data.peer)->sin_addr); in get_peer_address()
383 net_addr_ntop(peer_data.peer.sa_family, in get_peer_address()
384 &net_sin(&peer_data.peer)->sin_addr, addr_str, in get_peer_address()
566 struct sockaddr_ll *addr = (struct sockaddr_ll *)&peer_data.peer; in main()
613 ntohs(net_sin(&peer_data.peer)->sin_port), in main()
623 peer_data.sock = create_socket(iface, &peer_data.peer); in main()