subsys/net/ip/udp.h
/**
 * @brief Append UDP packet into net_pkt
 *
 * @param pkt Network packet
 * @param src_port Source port in host byte order.
 * @param dst_port Destination port in host byte order.
 *
 * @return Return network packet that contains the UDP packet.
 */
@brief Append UDP packet into net_pkt
@param pkt Network packet
@param src_port Source port in host byte order.
@param dst_port Destination port in host byte order.

@return Return network packet that contains the UDP packet.
@brief Append UDP packet into net_pkt @param pkt Network packet @param src_port Source port in host byte order . @param dst_port Destination port in host byte order . @return Return network packet that contains the UDP packet .
static inline struct net_pkt *net_udp_append_raw(struct net_pkt *pkt,
						 u16_t src_port,
						 u16_t dst_port)
{
	NET_UDP_HDR(pkt)->src_port = htons(src_port);
	NET_UDP_HDR(pkt)->dst_port = htons(dst_port);
	net_buf_add(pkt->frags, sizeof(struct net_udp_hdr));
	NET_UDP_HDR(pkt)->len = htons(net_pkt_get_len(pkt) -
				      net_pkt_ip_hdr_len(pkt));
	net_pkt_set_appdata(pkt, net_pkt_udp_data(pkt) +
			    sizeof(struct net_udp_hdr));
	return pkt;
}
static inline struct net_pkt * net_udp_append_raw ( struct net_pkt * pkt , u16_t src_port , u16_t dst_port ) { NET_UDP_HDR ( pkt ) -> src_port = htons ( src_port ) ; NET_UDP_HDR ( pkt ) -> dst_port = htons ( dst_port ) ; net_buf_add ( pkt -> frags , sizeof ( struct net_udp_hdr ) ) ; NET_UDP_HDR ( pkt ) -> len = htons ( net_pkt_get_len ( pkt ) - net_pkt_ip_hdr_len ( pkt ) ) ; net_pkt_set_appdata ( pkt , net_pkt_udp_data ( pkt ) + sizeof ( struct net_udp_hdr ) ) ; return pkt ; }
@brief Append UDP packet into net_pkt
 @param pkt Network packet
 @param src_port Source port in host byte order.
@brief Append UDP packet into net_pkt @param pkt Network packet @param src_port Source port in host byte order .