27 ssize_t
BgpBadMessage::parse(__attribute__((unused))
const uint8_t *from, __attribute__((unused))
size_t msg_sz) {
28 logger->
log(ERROR,
"BgpBadMessage::parse: unknow message type %d\n", type);
29 setError(E_HEADER, E_TYPE, &type, 1);
33 ssize_t
BgpBadMessage::write(__attribute__((unused)) uint8_t *to, __attribute__((unused))
size_t msg_sz)
const {
34 logger->
log(ERROR,
"BgpBadMessage::write: you can't write a bad message\n");
38 ssize_t
BgpBadMessage::doPrint(__attribute__((unused))
size_t indent, uint8_t **to, __attribute__((unused))
size_t *buf_sz)
const {
39 return _print(indent, to, buf_sz,
"InvalidMessage { }\n");
ssize_t write(uint8_t *to, size_t buf_sz) const
Serialize a BGP message body.
static ssize_t _print(size_t indent, uint8_t **to, size_t *buf_left, const char *format,...)
Print helper.
BgpBadMessage(BgpLogHandler *logger, uint8_t type)
Construct a new Bgp Bad Message:: Bgp Bad Message object.
Container for invalid BGP message.
void log(LogLevel level, const char *format_str,...)
Log a message. Consider using LIBBGP_LOG if logging the message needs a lot of computing power...
ssize_t parse(const uint8_t *from, size_t msg_sz)
Deserialize a BGP message body.
The BgpMessage base class.
void setError(uint8_t err, uint8_t suberr, const uint8_t *data, size_t data_len)
Set the error information.
ssize_t doPrint(size_t indent, uint8_t **to, size_t *buf_sz) const
Print implementation.