ns3-bgp  0.2
BGP module for ns-3.
bgp-log.cc
Go to the documentation of this file.
1 
11 #include <string.h>
12 #include "bgp-log.h"
13 #include "ns3/log.h"
14 
15 namespace ns3 {
16 
17 NS_LOG_COMPONENT_DEFINE("BgpLog");
18 
24 BgpLog::BgpLog(const char *owner) {
25  this->owner = strdup(owner);
26 }
27 
28 BgpLog::~BgpLog() {
29  free(owner);
30 }
31 
37 void BgpLog::logImpl(const char* str) {
38  char* str_stripped = strdup(str);
39  str_stripped[strlen(str_stripped)-1] = '\0';
40  NS_LOG_INFO(owner << " libbgp: " << str_stripped);
41  free(str_stripped);
42 }
43 
49 void BgpLog::SetOwner(const char* owner) {
50  free(this->owner);
51  this->owner = strdup(owner);
52 }
53 
54 }
void SetOwner(const char *owner)
Set the owner (prefix) of the log message.
Definition: bgp-log.cc:49
BgpLog(const char *owner)
Construct a new BgpLog object.
Definition: bgp-log.cc:24
Definition: bgp-log.cc:15
libbgp log forwarder.
void logImpl(const char *str)
Log implementation. See libbgp document.
Definition: bgp-log.cc:37