-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuffer_out.h
42 lines (29 loc) · 895 Bytes
/
buffer_out.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <stdint.h>
#include <vector>
#include "any_addr.h"
#include "buffer_in.h"
class buffer_out
{
private:
std::vector<uint8_t> buffer;
public:
buffer_out();
virtual ~buffer_out();
void add_net_byte (const uint8_t b);
void add_net_short(const uint16_t s);
void add_net_long (const uint32_t l);
// used by length fields
size_t add_net_short(const uint16_t s, const ssize_t offset);
size_t add_net_long (const uint32_t s, const ssize_t offset);
void add_any_addr(const any_addr & a);
void add_buffer_out(const buffer_out & o);
void add_buffer_in ( buffer_in & i);
void add_buffer(const uint8_t *const p, const size_t l);
// pad to a multiple of m
void add_padding(const int m);
const std::vector<uint8_t> & get_payload() const;
bool compare(const buffer_in & b) const;
size_t get_size() const;
const uint8_t *get_content() const;
};