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.
enum TimerType {
enum TimerType : uint8_t {
TIMER_BACKDOOR,
TIMER_BREAKPOINT,
TIMER_CONN_DELETE,
@ -51,8 +51,7 @@ class ODesc;
class Timer : public PQ_Element {
public:
Timer(double t, TimerType arg_type) : PQ_Element(t)
{ type = (char) arg_type; }
Timer(double t, TimerType arg_type) : PQ_Element(t), type(arg_type) { }
~Timer() override { }
TimerType Type() const { return (TimerType) type; }
@ -66,8 +65,7 @@ public:
protected:
Timer() {}
unsigned int type:8;
TimerType type;
};
class TimerMgr {

View file

@ -32,9 +32,9 @@ typedef enum {
struct NetbiosSSN_RawMsgHdr {
NetbiosSSN_RawMsgHdr(const u_char*& data, int& len);
unsigned int type:8;
unsigned int flags:8;
unsigned int length:16;
uint8_t type;
uint8_t flags;
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
@ -51,13 +51,13 @@ struct NetbiosSSN_RawMsgHdr {
struct NetbiosDGM_RawMsgHdr {
NetbiosDGM_RawMsgHdr(const u_char*& data, int& len);
unsigned int type:8;
unsigned int flags:8;
unsigned int id:16;
unsigned int srcip:32;
unsigned int srcport:16;
unsigned int length:16;
unsigned int offset:16;
uint8_t type;
uint8_t flags;
uint16_t id;
uint32_t srcip;
uint16_t srcport;
uint16_t length;
uint16_t offset;
};