Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
c
d
g
i
k
p
r
t
u
Functions
Variables
a
k
u
Typedefs
Enumerations
Classes
Class List
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
z
~
Functions
a
b
c
d
e
f
g
i
l
n
o
p
r
s
t
u
~
Variables
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
z
Enumerations
Enumerator
Files
File List
File Members
All
c
e
j
k
m
o
r
t
Functions
c
e
m
o
r
t
Variables
Typedefs
Macros
o
external
osef
include
tlvParser.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <sys/time.h>
4
5
#include "
tlvCommon.h
"
6
7
namespace
Tlv
8
{
9
// Read a TLV from a file descriptor
10
// Will try to use the passed buffer (and reallocate it if needed) to form the TLV.
11
// Pass out_buffer=nullptr and out_buffer_sz=0 to let the fuction allocate memory.
12
// in all cases, the caller is in charge of freeing out_buffer.
13
tlv_s *
readFromFile
(FILE *in_fd, uint8_t *&out_buffer,
size_t
&out_buffer_sz);
14
15
class
Parser
{
16
public
:
17
Parser
(
const
uint8_t *
buffer
,
size_t
buffer_size
);
18
19
// Return the first TLV in the buffer.
20
// If corruption is detected (incorrect length), it will return nullptr.
21
tlv_s *
getFirstTlv
(
void
);
22
23
// Repeatedly call this function to get the next Tlv in the buffer.
24
// It returns nullptr when no more is found (or if one of the TLV is corrupted)
25
tlv_s *
nextTlv
(
void
);
26
27
// Iterate through Tlvs and return the first one with specified type,
28
// or nullptr if none was found
29
tlv_s *
findTlv
(
type_t
type)
const
;
30
31
static
int
parseTimestamp
(
const
uint8_t *
buffer
,
size_t
buffer_size
, timeval &output);
32
33
private
:
34
const
uint8_t *
buffer
=
nullptr
;
35
size_t
buffer_size
= 0;
36
size_t
next_index
= 0;
// index used by nextSubTlv
37
38
tlv_s *
iter
(
size_t
&index)
const
;
39
};
40
41
}
// namespace Tlv
Tlv
Definition:
tlvCommon.h:6
Tlv::readFromFile
tlv_s * readFromFile(FILE *in_fd, uint8_t *&out_buffer, size_t &out_buffer_sz)
Definition:
tlvParser.cpp:27
Tlv::Parser::parseTimestamp
static int parseTimestamp(const uint8_t *buffer, size_t buffer_size, timeval &output)
Definition:
tlvParser.cpp:112
Tlv::Parser::getFirstTlv
tlv_s * getFirstTlv(void)
Definition:
tlvParser.cpp:64
Tlv::Parser::next_index
size_t next_index
Definition:
tlvParser.h:36
Tlv::Parser::buffer_size
size_t buffer_size
Definition:
tlvParser.h:35
Tlv::type_t
uint32_t type_t
Definition:
tlvCommon.h:9
Tlv::Parser::nextTlv
tlv_s * nextTlv(void)
Definition:
tlvParser.cpp:71
Tlv::Parser::buffer
const uint8_t * buffer
Definition:
tlvParser.h:34
Tlv::Parser
Definition:
tlvParser.h:15
Tlv::Parser::Parser
Parser(const uint8_t *buffer, size_t buffer_size)
Definition:
tlvParser.cpp:57
Tlv::Parser::findTlv
tlv_s * findTlv(type_t type) const
Definition:
tlvParser.cpp:76
Tlv::Parser::iter
tlv_s * iter(size_t &index) const
Definition:
tlvParser.cpp:88
tlvCommon.h
outsight_alb_driver
Author(s): Outsight
autogenerated on Thu Oct 13 2022 02:21:45