os_pcap.h
Packet Info
-
struct ouster::sensor_utils::packet_info
Public Members
-
std::string dst_ip
The destination IP.
-
std::string src_ip
The source IP.
-
int dst_port
The destination port.
-
int src_port
The source port.
-
size_t payload_size
The size of the packet payload.
-
size_t packet_size
The size of the full packet.
-
ts timestamp
The packet capture timestamp.
-
int fragments_in_packet
Number of fragments in the packet.
-
int ip_version
The ip version, 4 or 6.
-
int encapsulation_protocol
PCAP encapsulation type.
-
uint64_t file_offset
Where the packet is in the pcap.
-
int network_protocol
IANA protocol number. Always 17 (UDP)
-
std::string dst_ip
-
std::ostream &ouster::sensor_utils::operator<<(std::ostream &stream_in, const packet_info &data)
To string method for packet info structs.
- Parameters
stream_in – [inout] The pre-existing ostream to concat with data.
data – [in] The packet_info to output.
- Returns
The new output stream containing concatted stream_in and data.
Functions
-
std::shared_ptr<playback_handle> ouster::sensor_utils::replay_initialize(const std::string &file)
Initialize the stepwise playback handle.
- Parameters
file – [in] The file path of the pcap file.
- Returns
A handle to the initialized playback struct.
-
void ouster::sensor_utils::replay_uninitialize(playback_handle &handle)
Uninitialize the stepwise playback handle.
- Parameters
handle – [in] A handle to the initialized playback struct.
-
void ouster::sensor_utils::replay_reset(playback_handle &handle)
Restart playback from the beginning of the pcap file.
- Parameters
handle – [in] A handle to the initialized playback struct.
-
bool ouster::sensor_utils::next_packet_info(playback_handle &handle, packet_info &info)
Return the information on the next packet avaliable in the playback_handle. This must be called BEFORE calling the read_next_packet function.
- Parameters
handle – [in] The playback handle.
info – [out] The returned information on the next packet.
- Returns
The status on whether there is a new packet or not.
-
size_t ouster::sensor_utils::read_packet(playback_handle &handle, uint8_t *buf, size_t buffer_size)
Read the data from the next packet avaliable in the playback_handle. This must be called AFTER calling the next_packet_info function.
- Parameters
handle – [in] The playback handle.
buf – [out] The buffer to write the recieved data to (Must be sized appropriately.
buffer_size – [in] The size of the output buffer.
- Returns
0 on no new packet, > 0 the size of the bytes recieved.
Warning
doxygenfunction: Unable to resolve function “ouster::sensor_utils::record_initialize” with arguments (const std::string&, const std::string&, const std::string&, int, bool) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/sdk-extensions/docs/standard/multiversions/0.10.0/ouster-sdk/docs/_build/0.10.0/doctrees/xml. Potential matches:
- std::shared_ptr<record_handle> record_initialize(const std::string &file, int frag_size, bool use_sll_encapsulation = false)
-
std::shared_ptr<record_handle> ouster::sensor_utils::record_initialize(const std::string &file, int frag_size, bool use_sll_encapsulation = false)
Initialize the record handle for recording multi sensor pcap files. Source and destination IPs must be provided with each packet.
- Parameters
file – [in] The file path to the target pcap to record to.
frag_size – [in] The size of the fragments for packet fragmentation.
use_sll_encapsulation – [in] Whether to use sll encapsulation.
-
void ouster::sensor_utils::record_uninitialize(record_handle &handle)
Uninitialize the record handle, closing underlying file.
- Parameters
handle – [in] An initialized handle for the recording state.
-
void ouster::sensor_utils::record_packet(record_handle &handle, const std::string &src_ip, const std::string &dst_ip, int src_port, int dst_port, const uint8_t *buf, size_t buffer_size, uint64_t microsecond_timestamp)
Record a buffer to a multi sensor record_handle pcap file.
- Parameters
handle – [in] The record handle that record_initialize has initted.
src_ip – [in] The source address to label the packets with.
dst_ip – [in] The destination address to label the packets with.
src_port – [in] The source port to label the packets with.
dst_port – [in] The destination port to label the packets with.
buf – [in] The buffer to record to the pcap file.
buffer_size – [in] The size of the buffer to record to the pcap file.
microsecond_timestamp – [in] The timestamp to record the packet as microseconds.