Permalink
Browse files

replace journal with glog

current implementation of the logging facility leads to segfaults,
hereby it is replaced by glog
  • Loading branch information...
toanju committed Feb 1, 2017
1 parent 5168423 commit c004104bb2495681143dc0d3f7ebb3d17c09ef3b
Showing with 1,008 additions and 2,373 deletions.
  1. +1 −1 .travis.yml
  2. +6 −0 configure.ac
  3. +0 −36 examples/controller/controller.cpp
  4. +0 −15 examples/datapath/datapath.cpp
  5. +4 −4 examples/ethswctld/cetherswitch.cc
  6. +1 −1 examples/ethswctld/cunixenv.cc
  7. +0 −11 examples/tcpclient/tcpclient.h
  8. +0 −17 examples/tcpserver/tcpserver.h
  9. +0 −5 src/rofl/common/Makefile.am
  10. +4 −5 src/rofl/common/caddrinfos.h
  11. +0 −19 src/rofl/common/cjournal.cpp
  12. +0 −407 src/rofl/common/cjournal.hpp
  13. +0 −420 src/rofl/common/cjrnentry.hpp
  14. +1 −4 src/rofl/common/cmemory.h
  15. +3 −6 src/rofl/common/cpacket.h
  16. +68 −75 src/rofl/common/crofbase.cc
  17. +5 −33 src/rofl/common/crofbase.h
  18. +144 −252 src/rofl/common/crofconn.cc
  19. +7 −66 src/rofl/common/crofconn.h
  20. +169 −171 src/rofl/common/crofctl.cc
  21. +2 −25 src/rofl/common/crofctl.h
  22. +170 −121 src/rofl/common/crofdpt.cc
  23. +1 −24 src/rofl/common/crofdpt.h
  24. +143 −168 src/rofl/common/crofsock.cc
  25. +1 −44 src/rofl/common/crofsock.h
  26. +10 −0 src/rofl/common/cthread.cpp
  27. +17 −28 src/rofl/common/openflow/cofaction.h
  28. +6 −7 src/rofl/common/openflow/cofbucketcounter.h
  29. +2 −3 src/rofl/common/openflow/cofbuckets.h
  30. +3 −3 src/rofl/common/openflow/cofgroupmod.h
  31. +2 −4 src/rofl/common/openflow/cofinstruction.h
  32. +3 −6 src/rofl/common/openflow/cofmeterbandstats.h
  33. +7 −9 src/rofl/common/openflow/cofpacketqueue.h
  34. +3 −6 src/rofl/common/openflow/cofportdescprop.h
  35. +6 −7 src/rofl/common/openflow/cofqueueprop.h
  36. +2 −3 src/rofl/common/openflow/coftablefeatureprop.h
  37. +3 −6 src/rofl/common/openflow/coftablemodprop.h
  38. +28 −29 src/rofl/common/openflow/coftablestats.h
  39. +44 −68 src/rofl/common/openflow/coxmatch.h
  40. +18 −20 src/rofl/common/openflow/messages/cofmsg.h
  41. +2 −2 src/rofl/common/openflow/messages/cofmsg_aggr_stats.h
  42. +3 −3 src/rofl/common/openflow/messages/cofmsg_async_config.h
  43. +12 −17 src/rofl/common/openflow/messages/cofmsg_config.h
  44. +2 −2 src/rofl/common/openflow/messages/cofmsg_desc_stats.h
  45. +2 −2 src/rofl/common/openflow/messages/cofmsg_echo.h
  46. +2 −3 src/rofl/common/openflow/messages/cofmsg_experimenter.h
  47. +6 −6 src/rofl/common/openflow/messages/cofmsg_experimenter_stats.h
  48. +20 −26 src/rofl/common/openflow/messages/cofmsg_features.h
  49. +1 −2 src/rofl/common/openflow/messages/cofmsg_flow_mod.h
  50. +11 −11 src/rofl/common/openflow/messages/cofmsg_flow_removed.h
  51. +2 −2 src/rofl/common/openflow/messages/cofmsg_flow_stats.h
  52. +2 −2 src/rofl/common/openflow/messages/cofmsg_group_desc_stats.h
  53. +2 −2 src/rofl/common/openflow/messages/cofmsg_group_features_stats.h
  54. +1 −2 src/rofl/common/openflow/messages/cofmsg_group_mod.h
  55. +2 −2 src/rofl/common/openflow/messages/cofmsg_group_stats.h
  56. +2 −2 src/rofl/common/openflow/messages/cofmsg_meter_config_stats.h
  57. +4 −4 src/rofl/common/openflow/messages/cofmsg_meter_features_stats.h
  58. +2 −2 src/rofl/common/openflow/messages/cofmsg_meter_stats.h
  59. +1 −1 src/rofl/common/openflow/messages/cofmsg_packet_in.h
  60. +3 −4 src/rofl/common/openflow/messages/cofmsg_packet_out.h
  61. +2 −2 src/rofl/common/openflow/messages/cofmsg_port_desc_stats.h
  62. +1 −1 src/rofl/common/openflow/messages/cofmsg_port_mod.h
  63. +2 −2 src/rofl/common/openflow/messages/cofmsg_port_stats.h
  64. +2 −3 src/rofl/common/openflow/messages/cofmsg_port_status.h
  65. +2 −2 src/rofl/common/openflow/messages/cofmsg_queue_get_config.h
  66. +2 −2 src/rofl/common/openflow/messages/cofmsg_queue_stats.h
  67. +2 −2 src/rofl/common/openflow/messages/cofmsg_role.h
  68. +12 −16 src/rofl/common/openflow/messages/cofmsg_stats.h
  69. +2 −2 src/rofl/common/openflow/messages/cofmsg_table_features_stats.h
  70. +1 −1 src/rofl/common/openflow/messages/cofmsg_table_mod.h
  71. +2 −2 src/rofl/common/openflow/messages/cofmsg_table_stats.h
  72. +3 −29 test/rofl/common/crofbase/crofbasetest.cpp
  73. +1 −30 test/rofl/common/crofchan/crofchantest.cpp
  74. +0 −13 test/rofl/common/crofchan/crofchantest.hpp
  75. +3 −20 test/rofl/common/crofconn/crofconntest.cpp
  76. +0 −1 test/rofl/common/crofconn/crofconntest.hpp
  77. +0 −19 test/rofl/common/crofsock/crofsocktest.cpp
  78. +5 −0 tools/rpmbuild/SPECS/rofl-common.spec.in
View
@@ -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:
View
@@ -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
@@ -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
@@ -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;
};
@@ -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) {
@@ -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);
}
@@ -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;
}
@@ -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();
}
@@ -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();
};
@@ -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();
}
@@ -94,7 +94,7 @@ cunixenv::get_usage(char *argv0)
//Tabulate
for(int i= 30 - tmp.length();i>0;i--){
- tmp +=" ";
+ tmp += " ";
}
tmp +=" <"+it->description;
@@ -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;
};
@@ -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);
};
@@ -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;
};
@@ -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);
};
@@ -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;
- }
- }
};
/**
@@ -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 \
@@ -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 \
@@ -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) {
@@ -1,19 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * cjournal.cpp
- *
- * Created on: Oct 17, 2015
- * Author: andi
- */
-
-#include "cjournal.hpp"
-
-using namespace rofl;
-
-/*static*/std::set<cjournal_env*> cjournal_env::journal_envs;
-/*static*/crwlock cjournal_env::journal_envs_lock;
-/*static*/const unsigned int cjournal::MAX_ENTRIES_DEFAULT = 128;
-
Oops, something went wrong.

0 comments on commit c004104

Please sign in to comment.