udp: add udphdr definition

adapts to third-party code compilation. in the process of porting ConnMan,
we encounter some situations where the structure is not defined, or the
returned data types do not match the expectations. Refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2023-04-13 23:36:55 +08:00 committed by Xiang Xiao
parent 0acd3078ff
commit e565868eb4

View File

@ -31,4 +31,27 @@
* Pre-processor Definitions
****************************************************************************/
/* UDP header as specified by RFC 768, August 1980. */
struct udphdr
{
union
{
struct
{
uint16_t uh_sport; /* source port */
uint16_t uh_dport; /* destination port */
uint16_t uh_ulen; /* udp length */
uint16_t uh_sum; /* udp checksum */
};
struct
{
uint16_t source;
uint16_t dest;
uint16_t len;
uint16_t check;
};
};
};
#endif /* __INCLUDE_NETINET_UDP_H */