C Bitfields and network_uint16_t

Hi Everyone,

I am trying to define the Header Datastructure for the new TCP implementation. I'd like to use C Bitfields in structs for the Control Bits and would like to use the Type of network_uint16_t (That seems to be common for most other Header Structures). My compiler tells me that thats not possible because network_uint16_t is not an integer type.

In Byteorder.h it shows that its actually a union. Has anyone an Idea to solve this issue? I would really like to use only network types in my structure.

Thanks in advance.

Yours sincerly         Simon Brummer

Hi Simon, you can use network_uint16_t as integer by accessing it’s u16 member, but since bitfields are usually accessed using bit-arithmetics anyways I’m wondering if it makes so much sense to use network_uint16_t, since they are primarily used to warn about byteorder issues.

Cheers, Martine