Skip to content

Commit

Permalink
Fix portability: added windows style struct packing to gsmtap_hdr
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrkrysik committed Feb 27, 2018
1 parent ffbaca9 commit c0621c6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion include/grgsm/gsmtap.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@

#define GSMTAP_UDP_PORT 4729 /* officially registered with IANA */

#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
# define __WINDOWS__
#endif

#ifdef __WINDOWS__
#define PACKED( class_to_pack ) __pragma( pack(push, 1) ) class_to_pack __pragma( pack(pop) )
#else
#define PACKED( class_to_pack ) class_to_pack __attribute__((__packed__))
#endif
PACKED(
struct gsmtap_hdr {
uint8_t version; /* version, set to GSMTAP_VERSION */
uint8_t hdr_len; /* length in number of 32bit words */
Expand All @@ -67,6 +77,7 @@ struct gsmtap_hdr {
uint8_t sub_slot; /* sub-slot within timeslot */
uint8_t res; /* reserved for future use (RFU) */

} __attribute__((packed));
}
);

#endif /* _GSMTAP_H */

0 comments on commit c0621c6

Please sign in to comment.