libbgp  0.6
A C++ BGP Library.
bgp-message.h
Go to the documentation of this file.
1 
11 #ifndef BGP_MSG_H_
12 #define BGP_MSG_H_
13 #include <stdint.h>
14 #include <unistd.h>
15 #include "serializable.h"
16 #include "bgp-log-handler.h"
17 
18 namespace libbgp {
19 
25  OPEN = 1,
26  UPDATE = 2,
27  NOTIFICATION = 3,
28  KEEPALIVE = 4
29 };
30 
35 class BgpMessage : public Serializable {
36 public:
42  BgpMessage(BgpLogHandler *logger) : Serializable(logger) {}
43 
60  virtual ssize_t parse(const uint8_t *from, size_t msg_sz) = 0;
61 
75  virtual ssize_t write(uint8_t *to, size_t buf_sz) const = 0;
76 
77  uint8_t type;
78 
79  virtual ~BgpMessage() {}
80 };
81 
82 }
83 #endif // BGP_MSG_H_
BgpMessage(BgpLogHandler *logger)
Construct a new Bgp Message object.
Definition: bgp-message.h:42
BgpMessageType
BGP Message types.
Definition: bgp-message.h:24
The serializable base class.
Definition: serializable.h:26
The BgpMessage base class.
Definition: bgp-message.h:35
Definition: bgp-afi.h:14
The BgpLogHandler class.
virtual ssize_t write(uint8_t *to, size_t buf_sz) const =0
Serialize a BGP message body.
virtual ssize_t parse(const uint8_t *from, size_t msg_sz)=0
Deserialize a BGP message body.
BGP log handler.
The serializable base.