Skip to content

Commit

Permalink
replace journal with glog
Browse files Browse the repository at this point in the history
current implementation of the logging facility leads to segfaults,
hereby it is replaced by glog
  • Loading branch information
Tobias Jungel committed Feb 2, 2017
1 parent 5168423 commit c004104
Show file tree
Hide file tree
Showing 78 changed files with 1,008 additions and 2,373 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ compiler:
- clang
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq libssl-dev libcunit1-dev libcppunit-dev
- sudo apt-get install -y -qq libssl-dev libcunit1-dev libcppunit-dev libgoogle-glog-dev
install:
- ./autogen.sh
env:
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ m4_include([config/versioning.m4])
# Checking OpenSSL
m4_include([config/openssl.m4])

# check for glog
PKG_CHECK_MODULES([GLOG], libglog >= 0.3.3,
[ CPPFLAGS="$CPPFLAGS $GLOG_CFLAGS"
LIBS="$LIBS $GLOG_LIBS $GFLAGS_LIBS" ],
[ AC_MSG_ERROR([minimum version of glog is 0.3.3]) ])

AC_SEARCH_LIBS([pthread_rwlock_wrlock], [pthread], [], [AC_MSG_ERROR([lib pthread not found])])

# Output files
Expand Down
36 changes: 0 additions & 36 deletions examples/controller/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,6 @@ controller::run(
// register e.g. port number 3566 to act as a proxy
crofbase::ctl_sock_listen(rofl::csockaddr(AF_INET, "0.0.0.0", 3566));




/* All workflow related classes in rofl-common maintain a journal
* documenting history of their internal operations. This includes classes:
* rofl::crofbase => the base class to derive your application class from
* rofl::crofchan => representing an OpenFlow control channel
* rofl::crofconn => representing an OpenFlow control connection
* rofl::crofsock => representing an OpenFlow socket
*
* A journal stores by default 128 of the most recent log entries,
* replacing the oldest as the number of journal entries grows.
* If you want to keep more entries, just increase the journal's
* capacity. */

// define maximum threshold of journal entries
rofl::crofbase::set_journal().set_max_entries(1024);



/* rofl-common's OpenFlow protocol engine uses Posix threads
* for its internal operations. rofl creates and destroys
* threads automatically as needed, but make sure
Expand All @@ -101,10 +81,6 @@ controller::run(
pselect(0, NULL, NULL, NULL, &ts, NULL);
}

// dump journal on termination
std::cerr << ">>> journal log <<<" << std::endl;
std::cerr << crofbase::get_journal() << std::endl;

return 0;
};

Expand Down Expand Up @@ -223,18 +199,6 @@ controller::handle_conn_established(
* a log entry for each message received and sent by the control
* connection. */

// enable tracing on control connection 'auxid'
dpt.set_conn(auxid).set_trace(true);

// dump the OpenFlow control connection's journal ...
std::cerr << dpt.get_conn(auxid).get_journal() << std::endl;

// ... and the journal of the underlying OpenFlow socket if needed
std::cerr << dpt.get_conn(auxid).get_tcp_journal() << std::endl;




// auxid(0) always represents the main control connection
if (rofl::cauxid(0) == auxid) {

Expand Down
15 changes: 0 additions & 15 deletions examples/datapath/datapath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ datapath::run(
add_conn(rofl::cauxid(i)).
set_laddr(rofl::csockaddr(AF_INET, "0.0.0.0", 0)).
set_raddr(rofl::csockaddr(AF_INET, "127.0.0.1", 6653)).
set_trace(true).
tcp_connect(vbitmap, rofl::crofconn::MODE_DATAPATH, true);
}

Expand All @@ -65,24 +64,14 @@ datapath::run(
pselect(0, NULL, NULL, NULL, &ts, NULL);
}

for (auto auxid : crofbase::get_ctl(ctlid).keys()) {
std::cerr << ">>> journal for auxid: " << auxid << std::endl;
std::cerr << crofbase::get_ctl(ctlid).get_conn(auxid).get_journal() << std::endl;
std::cerr << crofbase::get_ctl(ctlid).get_conn(auxid).get_tcp_journal() << std::endl;
}

crofbase::set_ctl(ctlid).close();

std::cerr << crofbase::get_ctl(ctlid).get_journal() << std::endl;

crofbase::drop_ctl(ctlid);

unsigned int shutdown = 4;
while (--shutdown > 0)
{ std::cerr << "."; sleep(1); } std::cerr << std::endl;

std::cerr << crofbase::get_journal() << std::endl;

return 0;
}

Expand Down Expand Up @@ -245,8 +234,6 @@ datapath::handle_table_features_stats_request(
auxid,
msg.get_xid(),
tables);

std::cerr << rofl::crofbase::set_ctl(ctlid).set_conn(auxid).set_journal();
}


Expand All @@ -272,8 +259,6 @@ datapath::handle_table_stats_request(
auxid,
msg.get_xid(),
tablestatsarray);

std::cerr << rofl::crofbase::set_ctl(ctlid).set_conn(auxid).set_journal();
};


Expand Down
8 changes: 4 additions & 4 deletions examples/ethswctld/cetherswitch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,10 @@ cetherswitch::dump_packet_in(

//Dump some information
std::cerr << "[cetherswitch] PACKET-IN => frame seen, "
<< "buffer-id:0x" << std::hex << msg.get_buffer_id() << std::dec << " "
<< "eth-src:" << eth_src << " "
<< "eth-dst:" << eth_dst << " "
<< "eth-type:0x" << std::hex << (int)be16toh(eth_hdr->eth_type) << std::dec << " "
<< "buffer-id:0x" << std::hex << msg.get_buffer_id() << std::dec
<< " eth-src:" << eth_src
<< " eth-dst:" << eth_dst
<< " eth-type:0x" << std::hex << (int)be16toh(eth_hdr->eth_type) << std::dec
<< std::endl;
std::cerr << dpt.get_dpid();
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ethswctld/cunixenv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ cunixenv::get_usage(char *argv0)

//Tabulate
for(int i= 30 - tmp.length();i>0;i--){
tmp +=" ";
tmp += " ";
}

tmp +=" <"+it->description;
Expand Down
11 changes: 0 additions & 11 deletions examples/tcpclient/tcpclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,14 @@ class tcpclient :
pselect(0, NULL, NULL, NULL, &ts, NULL);
}

for (auto auxid : crofbase::get_ctl(ctlid).keys()) {
std::cerr << ">>> journal for auxid: " << auxid << std::endl;
std::cerr << crofbase::get_ctl(ctlid).get_conn(auxid).get_journal() << std::endl;
std::cerr << crofbase::get_ctl(ctlid).get_conn(auxid).get_tcp_journal() << std::endl;
}

crofbase::set_ctl(ctlid).close();

std::cerr << crofbase::get_ctl(ctlid).get_journal() << std::endl;

crofbase::drop_ctl(ctlid);

unsigned int shutdown = 4;
while (--shutdown > 0)
{ std::cerr << "."; sleep(1); } std::cerr << std::endl;

std::cerr << crofbase::get_journal() << std::endl;

return 0;
};

Expand All @@ -108,7 +98,6 @@ class tcpclient :
add_conn(auxid).
set_laddr(rofl::csockaddr(AF_INET, "0.0.0.0", 0)).
set_raddr(rofl::csockaddr(AF_INET, "127.0.0.1", 6653)).
set_trace(true).
tcp_connect(vbitmap, rofl::crofconn::MODE_DATAPATH, true);
};

Expand Down
17 changes: 0 additions & 17 deletions examples/tcpserver/tcpserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ class tcpserver :
pselect(0, NULL, NULL, NULL, &ts, NULL);
}

std::cerr << ">>> journal log <<<" << std::endl;
std::cerr << crofbase::get_journal() << std::endl;

return 0;
};

Expand Down Expand Up @@ -111,9 +108,6 @@ class tcpserver :
rofl::crofdpt& dpt)
{
std::cerr << "datapath attached dptid=" << dpt.get_dptid() << std::endl;

dpt.set_conn(rofl::cauxid(0)).set_trace(true);

dpt.send_port_desc_stats_request(rofl::cauxid(0), 0, 5);
};

Expand All @@ -135,17 +129,6 @@ class tcpserver :
std::cerr << "datapath detached dptid=" << dptid << std::endl;

stop();

for (auto dptid : crofbase::dpt_keys()) {
std::cerr << ">>> dpt journal for dptid: " << dptid << " <<<" << std::endl;
std::cerr << crofbase::get_dpt(dptid).get_journal() << std::endl;
for (auto auxid : crofbase::get_dpt(dptid).keys()) {
std::cerr << ">>> conn journal for dptid: " << dptid << ", auxid: " << auxid.str() << " <<<" << std::endl;
std::cerr << crofbase::get_dpt(dptid).get_conn(auxid).get_journal() << std::endl;
std::cerr << ">>> tcp journal for dptid: " << dptid << ", auxid: " << auxid.str() << " <<<" << std::endl;
std::cerr << crofbase::get_dpt(dptid).get_conn(auxid).get_tcp_journal() << std::endl;
}
}
};

/**
Expand Down
5 changes: 0 additions & 5 deletions src/rofl/common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ noinst_LTLIBRARIES = librofl_common_base.la
librofl_common_base_la_SOURCES = \
rofcommon.h \
exception.hpp \
cjournal.hpp \
cjournal.cpp \
cjrnentry.hpp \
locking.hpp \
crofbase.cc \
crofbase.h \
Expand Down Expand Up @@ -61,8 +58,6 @@ library_includedir=$(includedir)/rofl/common
library_include_HEADERS= \
rofcommon.h \
exception.hpp \
cjournal.hpp \
cjrnentry.hpp \
locking.hpp \
crofbase.h \
crofdpt.h \
Expand Down
9 changes: 4 additions & 5 deletions src/rofl/common/caddrinfos.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,10 @@ class caddrinfos {

friend std::ostream&
operator<< (std::ostream& os, const caddrinfos& dns) {
os << "<caddrinfos "
<< "node:" << dns.get_node() << " "
<< "service:" << dns.get_service() << " "
<< "#infos:" << dns.size() << " "
<< ">" << std::endl;
os << "<caddrinfos node:" << dns.get_node()
<< " service:" << dns.get_service()
<< " #infos:" << dns.size()
<< " >" << std::endl;

for (std::map<unsigned int, caddrinfo>::const_iterator
it = dns.get_addr_infos().begin(); it != dns.get_addr_infos().end(); ++it) {
Expand Down
19 changes: 0 additions & 19 deletions src/rofl/common/cjournal.cpp

This file was deleted.

Loading

0 comments on commit c004104

Please sign in to comment.