Skip to content

Commit

Permalink
core_dns Add typedef for request id, change it to uint16_t
Browse files Browse the repository at this point in the history
  • Loading branch information
attilamolnar committed Apr 21, 2015
1 parent 14d15d3 commit 4e58282
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion include/modules/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ namespace DNS
ERROR_INVALIDTYPE
};

typedef uint16_t RequestId;

const int PORT = 53;

/**
Expand Down Expand Up @@ -147,7 +149,7 @@ namespace DNS
/* Use result cache if available */
bool use_cache;
/* Request id */
unsigned short id;
RequestId id;
/* Creator of this request */
Module* const creator;

Expand Down
5 changes: 1 addition & 4 deletions src/coremods/core_dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Packet : public Query
static const int HEADER_LENGTH = 12;

/* ID for this packet */
unsigned short id;
RequestId id;
/* Flags on the packet */
unsigned short flags;

Expand All @@ -219,9 +219,6 @@ class Packet : public Query
this->id = (input[packet_pos] << 8) | input[packet_pos + 1];
packet_pos += 2;

if (this->id >= MAX_REQUEST_ID)
throw Exception("Query ID too large?");

this->flags = (input[packet_pos] << 8) | input[packet_pos + 1];
packet_pos += 2;

Expand Down

0 comments on commit 4e58282

Please sign in to comment.