Use fixed types in NetbiosSSN.h and Timer.h instead of bit fields

This commit is contained in:
Tim Wojtulewicz 2019-12-10 15:34:02 -07:00
parent 0c55b01ec9
commit a463c5763f
2 changed files with 13 additions and 15 deletions

View file

@ -12,7 +12,7 @@ extern "C" {
} }
// If you add a timer here, adjust TimerNames in Timer.cc. // If you add a timer here, adjust TimerNames in Timer.cc.
enum TimerType { enum TimerType : uint8_t {
TIMER_BACKDOOR, TIMER_BACKDOOR,
TIMER_BREAKPOINT, TIMER_BREAKPOINT,
TIMER_CONN_DELETE, TIMER_CONN_DELETE,
@ -51,8 +51,7 @@ class ODesc;
class Timer : public PQ_Element { class Timer : public PQ_Element {
public: public:
Timer(double t, TimerType arg_type) : PQ_Element(t) Timer(double t, TimerType arg_type) : PQ_Element(t), type(arg_type) { }
{ type = (char) arg_type; }
~Timer() override { } ~Timer() override { }
TimerType Type() const { return (TimerType) type; } TimerType Type() const { return (TimerType) type; }
@ -66,8 +65,7 @@ public:
protected: protected:
Timer() {} Timer() {}
TimerType type;
unsigned int type:8;
}; };
class TimerMgr { class TimerMgr {

View file

@ -32,9 +32,9 @@ typedef enum {
struct NetbiosSSN_RawMsgHdr { struct NetbiosSSN_RawMsgHdr {
NetbiosSSN_RawMsgHdr(const u_char*& data, int& len); NetbiosSSN_RawMsgHdr(const u_char*& data, int& len);
unsigned int type:8; uint8_t type;
unsigned int flags:8; uint8_t flags;
unsigned int length:16; uint16_t length;
}; };
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@ -51,13 +51,13 @@ struct NetbiosSSN_RawMsgHdr {
struct NetbiosDGM_RawMsgHdr { struct NetbiosDGM_RawMsgHdr {
NetbiosDGM_RawMsgHdr(const u_char*& data, int& len); NetbiosDGM_RawMsgHdr(const u_char*& data, int& len);
unsigned int type:8; uint8_t type;
unsigned int flags:8; uint8_t flags;
unsigned int id:16; uint16_t id;
unsigned int srcip:32; uint32_t srcip;
unsigned int srcport:16; uint16_t srcport;
unsigned int length:16; uint16_t length;
unsigned int offset:16; uint16_t offset;
}; };