Skip to content

Commit e565868

Browse files
zhhyu7xiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent 0acd307 commit e565868

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

include/netinet/udp.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,27 @@
3131
* Pre-processor Definitions
3232
****************************************************************************/
3333

34+
/* UDP header as specified by RFC 768, August 1980. */
35+
36+
struct udphdr
37+
{
38+
union
39+
{
40+
struct
41+
{
42+
uint16_t uh_sport; /* source port */
43+
uint16_t uh_dport; /* destination port */
44+
uint16_t uh_ulen; /* udp length */
45+
uint16_t uh_sum; /* udp checksum */
46+
};
47+
struct
48+
{
49+
uint16_t source;
50+
uint16_t dest;
51+
uint16_t len;
52+
uint16_t check;
53+
};
54+
};
55+
};
56+
3457
#endif /* __INCLUDE_NETINET_UDP_H */

0 commit comments

Comments
 (0)