Header file that exposes the public interface of a bgpstream record.
Public Opaque Data Structures
bgpstream_record_internal_t
¶Opaque structure used internally by BGPStream to store raw data obtained from the underlying data resource.
Public Enums
bgpstream_record_type_t
¶The type of the record.
Values:
BGPSTREAM_UPDATE
= 0¶The record contains data for a BGP Update message.
BGPSTREAM_RIB
= 1¶The record contains data for a BGP RIB message.
_BGPSTREAM_RECORD_TYPE_CNT
= 2¶INTERNAL: The number of record types in use.
bgpstream_dump_position_t
¶The position of this record in the dump.
Values:
BGPSTREAM_DUMP_START
= 0¶This is the first record of the dump.
BGPSTREAM_DUMP_MIDDLE
= 1¶This is a record in the middle of the dump.
i.e. not the first or the last record of the dump
BGPSTREAM_DUMP_END
= 2¶This is the last record of the dump.
bgpstream_record_status_t
¶Status of the record.
Values:
BGPSTREAM_RECORD_STATUS_VALID_RECORD
= 0¶The record is valid and may be used.
BGPSTREAM_RECORD_STATUS_FILTERED_SOURCE
= 1¶Source is not empty, but no valid record was found.
BGPSTREAM_RECORD_STATUS_EMPTY_SOURCE
= 2¶Source has no entries.
BGPSTREAM_RECORD_STATUS_OUTSIDE_TIME_INTERVAL
= 3¶Record read with timestamp “above” all interval filters.
BGPSTREAM_RECORD_STATUS_CORRUPTED_SOURCE
= 4¶BGPSTREAM_RECORD_STATUS_CORRUPTED_RECORD
= 5¶BGPSTREAM_RECORD_STATUS_UNSUPPORTED_RECORD
= 6¶Public Data Structures
bgpstream_record_t
¶Record structure.
Public API Functions
bgpstream_record_get_next_elem
(bgpstream_record_t
*record, bgpstream_elem_t **elem)¶Retrieve the next elem from the record.
The returned pointer is guaranteed to be valid until the record is re-used in a subsequent call to bgpstream_get_next_record, or is destroyed with bgpstream_record_destroy
record
: pointer to the
BGP Stream Record to retrieve the elem from
elem
: set to point to a
borrowed elem structure, or NULL if there are no more elems
bgpstream_record_type_snprintf
(char *buf,
size_t len, const bgpstream_record_type_t
type)¶Write the string representation of the record type into the provided buffer.
buf
: pointer to a char
array
len
: length of the char
array
type
: record type to
convert to string
bgpstream_record_dump_pos_snprintf
(char *buf,
size_t len, bgpstream_dump_position_t
dump_pos)¶Write the string representation of the record dump position into the provided buffer.
buf
: pointer to a char
array
len
: length of the char
array
dump_pos
: BGP Stream
Record dump position to convert to string
bgpstream_record_status_snprintf
(char *buf,
size_t len, bgpstream_record_status_t
status)¶Write the string representation of the record status into the provided buffer.
buf
: pointer to a char
array
len
: length of the char
array
status
: BGP Stream Record
status to convert to string
bgpstream_record_snprintf
(char
*buf, size_t len, const bgpstream_record_t
*record)¶Write the string representation of the record into the provided buffer.
buf
: pointer to a char
array
len
: length of the char
array
record
: pointer to a BGP
Stream Record to convert to string
bgpstream_record_elem_snprintf
(char
*buf, size_t len, const bgpstream_record_t
*record, const bgpstream_elem_t *elem)¶Write the string representation of the record/elem into the provided buffer.
buf
: pointer to a char
array
len
: length of the char
array
record
: pointer to a BGP
Stream Record to convert to string
elem
: pointer to a BGP
Stream Elem to convert to string
bgpstream_record
¶Record structure.
Public Members
type
¶Type.
Indicates if this record comes from a RIB dump, or from a BGP Update message.
status
¶Status of this record.
time_sec
¶Collection time (seconds component)
The time the record was received/generated by the collector. For RIB records, this is the time the RIB entry was dumped by the collector, whereas for UPDATE records, this is the time the collector received the message. It is possible for this field to be zero, e.g., when reading BMP data directly from a raw BMP dump (i.e., not from an OpenBMP-based collector) as BMP does not explicitly include collection time information. This may cause problems with any time interval filters in place.
time_usec
¶Collection time (microseconds component)
Care must be taken when using this field. First, if time_sec
is zero, then this field should be ignored. Second,
if this field is zero, then it should be assumed that the timestamp is accurate only to
second granularity. Third, even some collection formats provide microsecond granularity
timing information, most collectors are running on commodity hardware with clocks that have
unknown accuracy.
project_name
[BGPSTREAM_UTILS_STR_NAME_LEN]¶Project name.
When set, this is a BGPStream-specific string that identifies the adminstrative organization that operates the BGP collector that collected this information. That is, “projects” operate “collectors”, which collect data from “routers”, who have “peers”.
collector_name
[BGPSTREAM_UTILS_STR_NAME_LEN]¶Collector name.
This is a BGPStream-specific string that identifies the “collector”, within the “project” that collected this BGP data. When using the broker data interface, the collector name is provided by the broker, and usually maps as closely as possible to the collector names used by the given project. When processing data directly from an OpenBMP kafka stream, the collector name is the “Admin ID” configured on the collector, which is set by the collection operator (the “project”). When using other data interfaces, this collector name is normally set manually.
router_name
[BGPSTREAM_UTILS_STR_NAME_LEN]¶Router name.
This field is only used when processing data obtained from an OpenBMP kafka stream (e.g., bmp.bgpstream.caida.org). It is a name set by the collection “project”, and is unique for a given collector. If unused or unknown, it will be set to the empty string.
router_ip
¶Router IP.
This is the IP address that the (BMP) router used when connecting to the collector. If the version is set to zero, then it is not in use (as is the case when not processing data from an OpenBMP kafka stream.
It is possible (but unlikely) that the Router IP to be set, but the router name is empty. In this case the router IP should be used to identify the router.
dump_pos
¶Position of this record in the dump.
dump_time_sec
¶Time that the BGP data was “aggregated”.
E.g. the start time of an MRT dump file. If the dump start time was unknown (e.g., the record came from a streaming source), this will be set to 0.
__int
¶INTERNAL BGPStream State.
Do not use.