| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 
|---|---|
| 2 | #ifndef _LINUX_DCCP_H | 
| 3 | #define _LINUX_DCCP_H | 
| 4 | |
| 5 | #include <uapi/linux/dccp.h> | 
| 6 | |
| 7 | static inline struct dccp_hdr_ext *dccp_hdrx(const struct dccp_hdr *dh) | 
| 8 | { | 
| 9 | return (struct dccp_hdr_ext *)((unsigned char *)dh + sizeof(*dh)); | 
| 10 | } | 
| 11 | |
| 12 | static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) | 
| 13 | { | 
| 14 | return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0); | 
| 15 | } | 
| 16 | |
| 17 | static inline __u64 dccp_hdr_seq(const struct dccp_hdr *dh) | 
| 18 | { | 
| 19 | __u64 seq_nr = ntohs(dh->dccph_seq); | 
| 20 | |
| 21 | if (dh->dccph_x != 0) | 
| 22 | seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(dh)->dccph_seq_low); | 
| 23 | else | 
| 24 | seq_nr += (u32)dh->dccph_seq2 << 16; | 
| 25 | |
| 26 | return seq_nr; | 
| 27 | } | 
| 28 | |
| 29 | static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) | 
| 30 | { | 
| 31 | return __dccp_basic_hdr_len(dh) + | 
| 32 | dccp_packet_hdr_len(type: dh->dccph_type); | 
| 33 | } | 
| 34 | |
| 35 | #endif /* _LINUX_DCCP_H */ | 
| 36 | 
