Deprecate the internal int/uint types in favor of the cstdint types they were based on

This commit is contained in:
Tim Wojtulewicz 2019-07-30 11:38:42 -07:00
parent 18e4976c6c
commit 54752ef9a1
218 changed files with 1331 additions and 1323 deletions

View file

@ -38,7 +38,7 @@ public:
EndpointState State() const { return state; }
void SetState(EndpointState new_state);
uint64 Size() const;
uint64_t Size() const;
int IsActive() const
{ return state != TCP_ENDPOINT_INACTIVE && ! did_close; }
@ -48,45 +48,45 @@ public:
/**
* @return The starting TCP sequence number for this endpoint.
*/
uint32 StartSeq() const { return static_cast<uint32>(start_seq); }
uint32_t StartSeq() const { return static_cast<uint32_t>(start_seq); }
/**
* @return The starting TCP sequence number for this endpoint, in terms
* of a signed sequence space, which may account for initial
* sequence space wraparounds (underflow/overflow).
*/
int64 StartSeqI64() const { return start_seq; }
int64_t StartSeqI64() const { return start_seq; }
/**
* @return The sequence number after the last TCP sequence number seen
* from this endpoint.
*/
uint32 LastSeq() const { return last_seq; }
uint32_t LastSeq() const { return last_seq; }
/**
* @return The last TCP acknowledgement number seen from this endpoint.
*/
uint32 AckSeq() const { return ack_seq; }
uint32_t AckSeq() const { return ack_seq; }
/**
* @return The number of times the TCP sequence has wrapped around
* for this endpoint (i.e. overflowed a uint32).
* for this endpoint (i.e. overflowed a uint32_t).
*/
uint32 SeqWraps() const { return seq_wraps; }
uint32_t SeqWraps() const { return seq_wraps; }
/**
* @return The number of times the TCP acknowledgement sequence has
* wrapped around for this endpoint (i.e. overflowed a uint32).
* wrapped around for this endpoint (i.e. overflowed a uint32_t).
*/
uint32 AckWraps() const { return ack_wraps; }
uint32_t AckWraps() const { return ack_wraps; }
/**
* @param wraps Number of times a 32-bit sequence space has wrapped.
* @return A 64-bit sequence space number it would take to overflow
* a 32-bit sequence space \a wraps number of times.
*/
static uint64 ToFullSeqSpace(uint32 wraps)
{ return (uint64(wraps) << 32); }
static uint64_t ToFullSeqSpace(uint32_t wraps)
{ return (uint64_t(wraps) << 32); }
/**
* @param tcp_seq_num A 32-bit TCP sequence space number.
@ -94,7 +94,7 @@ public:
* @return \a tcp_seq_num expanded out in to a 64-bit sequence space,
* accounting for the number of times the 32-bit space overflowed.
*/
static uint64 ToFullSeqSpace(uint32 tcp_seq_num, uint32 wraparounds)
static uint64_t ToFullSeqSpace(uint32_t tcp_seq_num, uint32_t wraparounds)
{ return ToFullSeqSpace(wraparounds) + tcp_seq_num; }
/**
@ -104,16 +104,16 @@ public:
* accounting for the number of times the 32-bit space overflowed
* and relative to the starting sequence number for this endpoint.
*/
uint64 ToRelativeSeqSpace(uint32 tcp_seq_num, uint32 wraparounds) const
uint64_t ToRelativeSeqSpace(uint32_t tcp_seq_num, uint32_t wraparounds) const
{
return ToFullSeqSpace(tcp_seq_num, wraparounds) - StartSeqI64();
}
void InitStartSeq(int64 seq) { start_seq = seq; }
void InitLastSeq(uint32 seq) { last_seq = seq; }
void InitAckSeq(uint32 seq) { ack_seq = seq; }
void InitStartSeq(int64_t seq) { start_seq = seq; }
void InitLastSeq(uint32_t seq) { last_seq = seq; }
void InitAckSeq(uint32_t seq) { ack_seq = seq; }
void UpdateLastSeq(uint32 seq)
void UpdateLastSeq(uint32_t seq)
{
if ( seq < last_seq )
++seq_wraps;
@ -121,7 +121,7 @@ public:
last_seq = seq;
}
void UpdateAckSeq(uint32 seq)
void UpdateAckSeq(uint32_t seq)
{
if ( seq < ack_seq )
++ack_wraps;
@ -134,8 +134,8 @@ public:
// an initial SYN exchange.
int NoDataAcked() const
{
uint64 ack = ToFullSeqSpace(ack_seq, ack_wraps);
uint64 start = static_cast<uint64>(StartSeqI64());
uint64_t ack = ToFullSeqSpace(ack_seq, ack_wraps);
uint64_t start = static_cast<uint64_t>(StartSeqI64());
return ack == start || ack == start + 1;
}
@ -162,7 +162,7 @@ public:
//
// If we're not processing contents, then naturally each of
// these is empty.
void SizeBufferedData(uint64& waiting_on_hole, uint64& waiting_on_ack);
void SizeBufferedData(uint64_t& waiting_on_hole, uint64_t& waiting_on_ack);
int ValidChecksum(const struct tcphdr* tp, int len) const;
@ -176,14 +176,14 @@ public:
void ZeroWindow();
// Called to inform endpoint that a gap occurred.
void Gap(uint64 seq, uint64 len);
void Gap(uint64_t seq, uint64_t len);
// Returns true if the data was used (and hence should be recorded
// in the save file), false otherwise.
int DataSent(double t, uint64 seq, int len, int caplen, const u_char* data,
int DataSent(double t, uint64_t seq, int len, int caplen, const u_char* data,
const IP_Hdr* ip, const struct tcphdr* tp);
void AckReceived(uint64 seq);
void AckReceived(uint64_t seq);
void SetContentsFile(BroFile* f);
BroFile* GetContentsFile() const { return contents_file; }
@ -201,7 +201,7 @@ public:
#define HIST_CORRUPT_PKT 0x80
#define HIST_RXMIT 0x100
#define HIST_WIN0 0x200
int CheckHistory(uint32 mask, char code);
int CheckHistory(uint32_t mask, char code);
void AddHistory(char code);
//### combine into a set of flags:
@ -210,17 +210,17 @@ public:
TCP_Reassembler* contents_processor;
TCP_Analyzer* tcp_analyzer;
BroFile* contents_file;
uint32 checksum_base;
uint32_t checksum_base;
double start_time, last_time;
IPAddr src_addr; // the other endpoint
IPAddr dst_addr; // this endpoint
uint32 window; // current advertised window (*scaled*, not pre-scaling)
uint32_t window; // current advertised window (*scaled*, not pre-scaling)
int window_scale; // from the TCP option
uint32 window_ack_seq; // at which ack_seq number did we record 'window'
uint32 window_seq; // at which sending sequence number did we record 'window'
uint64 contents_start_seq; // relative seq # where contents file starts
uint64 FIN_seq; // relative seq # to start_seq
uint32_t window_ack_seq; // at which ack_seq number did we record 'window'
uint32_t window_seq; // at which sending sequence number did we record 'window'
uint64_t contents_start_seq; // relative seq # where contents file starts
uint64_t FIN_seq; // relative seq # to start_seq
int SYN_cnt, FIN_cnt, RST_cnt;
int did_close; // whether we've reported it closing
int is_orig;
@ -228,22 +228,22 @@ public:
// Relative sequence numbers associated with last control packets.
// Used to determine whether ones seen again are interesting,
// for tracking history.
uint64 hist_last_SYN, hist_last_FIN, hist_last_RST;
uint64_t hist_last_SYN, hist_last_FIN, hist_last_RST;
protected:
int64 start_seq; // Initial TCP sequence number in host order.
int64_t start_seq; // Initial TCP sequence number in host order.
// Signed 64-bit to detect initial sequence wrapping.
// Use StartSeq() accessor if need it in terms of
// an absolute TCP sequence number.
uint32 last_seq, ack_seq; // in host order
uint32 seq_wraps, ack_wraps; // Number of times 32-bit TCP sequence space
uint32_t last_seq, ack_seq; // in host order
uint32_t seq_wraps, ack_wraps; // Number of times 32-bit TCP sequence space
// has wrapped around (overflowed).
// Performance history accounting.
uint32 chk_cnt, chk_thresh;
uint32 rxmt_cnt, rxmt_thresh;
uint32 win0_cnt, win0_thresh;
uint32 gap_cnt, gap_thresh;
uint32_t chk_cnt, chk_thresh;
uint32_t rxmt_cnt, rxmt_thresh;
uint32_t win0_cnt, win0_thresh;
uint32_t gap_cnt, gap_thresh;
};
#define ENDIAN_UNKNOWN 0