tcpflow  1.6.1
About: tcpflow is a TCP/IP packet demultiplexer that captures data transmitted as part of TCP connections (flows), and stores the data in a way that is convenient for protocol analysis and debugging.
  Fossies Dox: tcpflow-1.6.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

sbuf_stream.h
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 #ifndef SBUF_STREAM_H
3 #define SBUF_STREAM_H
4 
5 /* required per C++ standard */
6 #ifndef __STDC_FORMAT_MACROS
7 #define __STDC_FORMAT_MACROS
8 #endif
9 
10 using namespace std;
11 
12 #include <stdlib.h>
13 #include <inttypes.h>
14 #include <string>
15 #include <sstream>
16 #include "sbuf.h"
17 
18 /** \addtogroup bulk_extractor_APIs
19  * @{
20  */
21 
22 /** \file */
23 /**
24  * sbuf_stream provides the get services of sbuf_t but wrapped in a Stream interface.
25  * Note that sbuf_stream is not particularly optimized; it is simply a wrapper.
26  */
27 class sbuf_stream {
28 private:
29  const sbuf_t sbuf;
30  size_t offset;
31 public:
32  sbuf_stream(const sbuf_t &sbuf_);
33  ~sbuf_stream();
34  void seek(size_t offset);
35  size_t tell();
36 
37  /**
38  * \name integer-based stream readers
39  * @{ */
40  uint8_t get8u();
41  uint16_t get16u();
42  uint32_t get32u();
43  uint64_t get64u();
44 
45  uint8_t get8uBE();
48  uint64_t get64uBE();
49 
53  uint64_t get64u(sbuf_t::byte_order_t bo);
54 
55  int8_t get8i();
56  int16_t get16i();
57  int32_t get32i();
58  int64_t get64i();
59 
60  int8_t get8iBE();
61  int16_t get16iBE();
62  int32_t get32iBE();
63  int64_t get64iBE();
64 
65  int8_t get8i(sbuf_t::byte_order_t bo);
66  int16_t get16i(sbuf_t::byte_order_t bo);
67  int32_t get32i(sbuf_t::byte_order_t bo);
68  int64_t get64i(sbuf_t::byte_order_t bo);
69  /** @} */
70 
71  /**
72  * \name string and wstring stream readers
73  * @{ */
74  void getUTF8(string &utf8_string);
75  void getUTF8(size_t num_octets_requested, string &utf8_string);
76  void getUTF16(wstring &utf16_string);
77  void getUTF16(size_t num_code_units_requested, wstring &utf16_string);
78  /** @} */
79 };
80 
81 #endif
Definition: sbuf.h:221
int64_t get64iBE()
int8_t get8i()
Definition: sbuf_stream.cpp:98
int8_t get8iBE()
int32_t get32iBE()
uint64_t get64u()
Definition: sbuf_stream.cpp:41
byte_order_t
Definition: sbuf.h:482
uint16_t get16u()
Definition: sbuf_stream.cpp:31
uint16_t get16uBE()
Definition: sbuf_stream.cpp:55
uint8_t get8u()
Definition: sbuf_stream.cpp:26
size_t offset
Definition: sbuf_stream.h:30
void getUTF8(string &utf8_string)
int16_t get16iBE()
uint8_t get8uBE()
Definition: sbuf_stream.cpp:50
void getUTF16(wstring &utf16_string)
uint64_t get64uBE()
Definition: sbuf_stream.cpp:65
size_t tell()
Definition: sbuf_stream.cpp:19
uint32_t get32uBE()
Definition: sbuf_stream.cpp:60
int64_t get64i()
const sbuf_t sbuf
Definition: sbuf_stream.h:29
sbuf_stream(const sbuf_t &sbuf_)
Definition: sbuf_stream.cpp:9
int32_t get32i()
void seek(size_t offset)
Definition: sbuf_stream.cpp:15
uint32_t get32u()
Definition: sbuf_stream.cpp:36
int16_t get16i()
unsigned int uint32_t
Definition: core.h:40
unsigned short uint16_t
Definition: util.h:7
unsigned char uint8_t
Definition: util.h:6