#include <log.hh>
Inheritance diagram for LogFilter:


Public Member Functions | |
| LogFilter (int argc, char **argv) | |
| void | run () |
| void | recv (Message *msg, handle h) |
Protected Member Functions | |
| handle | setupFilter () |
| void | ProcessMessage (Message *msg) |
| void | usage (char *s) |
| void | parseCommandLine (int argc, char **argv) |
Protected Attributes | |
| handle | filter_handle_ |
| LogFilterReceive * | filter_callback_ |
| NR * | dr_ |
| u_int16_t | diffusion_port_ |
| char * | config_file_ |
|
||||||||||||
|
Definition at line 120 of file log.cc. References NR::createNR(), DEBUG_ALWAYS, and DiffPrint().
00122 {
00123 // Create Diffusion Routing class
00124 #ifndef NS_DIFFUSION
00125 parseCommandLine(argc, argv);
00126 dr_ = NR::createNR(diffusion_port_);
00127 #endif // !NS_DIFFUSION
00128
00129 filter_callback_ = new LogFilterReceive(this);
00130
00131 #ifndef NS_DIFFUSION
00132 // Set up the filter
00133 filter_handle_ = setupFilter();
00134 DiffPrint(DEBUG_ALWAYS, "Log filter subscribed to *, received handle %d\n", filter_handle_);
00135 DiffPrint(DEBUG_ALWAYS, "Log filter initialized !\n");
00136 #endif // !NS_DIFFUSION
00137 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 59 of file diffapp.cc. References DiffApp::config_file_, DEBUG_ALWAYS, DEFAULT_DIFFUSION_PORT, DiffPrint(), DiffApp::diffusion_port_, global_debug_level, optarg, u_int16_t, and DiffApp::usage(). Referenced by GeoRoutingFilter::GeoRoutingFilter(), GradientFilter::GradientFilter(), PingSenderApp::PingSenderApp(), PushSenderApp::PushSenderApp(), and SrcRtFilter::SrcRtFilter().
00060 {
00061 u_int16_t diff_port = DEFAULT_DIFFUSION_PORT;
00062 int debug_level;
00063 int opt;
00064
00065 config_file_ = NULL;
00066 opterr = 0;
00067
00068 while (1){
00069 opt = getopt(argc, argv, "f:hd:p:");
00070 switch (opt){
00071
00072 case 'p':
00073
00074 diff_port = (u_int16_t) atoi(optarg);
00075 if ((diff_port < 1024) || (diff_port >= 65535)){
00076 DiffPrint(DEBUG_ALWAYS, "Error: Diffusion port must be between 1024 and 65535 !\n");
00077 exit(-1);
00078 }
00079
00080 break;
00081
00082 case 'h':
00083
00084 usage(argv[0]);
00085
00086 break;
00087
00088 case 'd':
00089
00090 debug_level = atoi(optarg);
00091
00092 if (debug_level < 1 || debug_level > 10){
00093 DiffPrint(DEBUG_ALWAYS, "Error: Debug level outside range or missing !\n");
00094 usage(argv[0]);
00095 }
00096
00097 global_debug_level = debug_level;
00098
00099 break;
00100
00101 case 'f':
00102
00103 if (!strncasecmp(optarg, "-", 1)){
00104 DiffPrint(DEBUG_ALWAYS, "Error: Parameter missing !\n");
00105 usage(argv[0]);
00106 }
00107
00108 config_file_ = strdup(optarg);
00109
00110 break;
00111
00112 case '?':
00113
00114 DiffPrint(DEBUG_ALWAYS,
00115 "Error: %c isn't a valid option or its parameter is missing !\n", optopt);
00116 usage(argv[0]);
00117
00118 break;
00119
00120 case ':':
00121
00122 DiffPrint(DEBUG_ALWAYS, "Parameter missing !\n");
00123 usage(argv[0]);
00124
00125 break;
00126
00127 }
00128
00129 if (opt == -1)
00130 break;
00131 }
00132
00133 diffusion_port_ = diff_port;
00134 }
|
Here is the call graph for this function:

|
|
Definition at line 68 of file log.cc. References CalculateSize(), DEBUG_ALWAYS, DiffPrint(), Message::last_hop_, LOCALHOST_ADDR, Message::msg_attr_vec_, Message::msg_type_, msg_types, Message::new_message_, and Message::source_port_. Referenced by recv().
00069 {
00070 DiffPrint(DEBUG_ALWAYS, "Received a");
00071
00072 if (msg->new_message_)
00073 DiffPrint(DEBUG_ALWAYS, " new ");
00074 else
00075 DiffPrint(DEBUG_ALWAYS, "n old ");
00076
00077 if (msg->last_hop_ != LOCALHOST_ADDR)
00078 DiffPrint(DEBUG_ALWAYS, "%s message from node %d, %d bytes\n",
00079 msg_types[msg->msg_type_], msg->last_hop_,
00080 CalculateSize(msg->msg_attr_vec_));
00081 else
00082 DiffPrint(DEBUG_ALWAYS, "%s message from agent %d, %d bytes\n",
00083 msg_types[msg->msg_type_], msg->source_port_,
00084 CalculateSize(msg->msg_attr_vec_));
00085 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 55 of file log.cc. References DEBUG_ALWAYS, DiffPrint(), DiffApp::dr_, filter_handle_, and ProcessMessage(). Referenced by LogFilterReceive::recv().
00056 {
00057 if (h != filter_handle_){
00058 DiffPrint(DEBUG_ALWAYS,
00059 "Error: recv received message for handle %d when subscribing to handle %d !\n", h, filter_handle_);
00060 return;
00061 }
00062
00063 ProcessMessage(msg);
00064
00065 ((DiffusionRouting *)dr_)->sendMessage(msg, h);
00066 }
|
Here is the call graph for this function:

|
|
Implements DiffApp. Definition at line 102 of file log.cc. References DEBUG_ALWAYS, DiffPrint(), filter_handle_, and setupFilter(). Referenced by main().
00103 {
00104 #ifdef NS_DIFFUSION
00105 filter_handle_ = setupFilter();
00106 DiffPrint(DEBUG_ALWAYS, "Log filter subscribed to *, received handle %d\n",
00107 filter_handle_);
00108 DiffPrint(DEBUG_ALWAYS, "Log filter initialized !\n");
00109 #else
00110 // Doesn't do anything
00111 while (1){
00112 sleep(1000);
00113 }
00114 #endif // NS_DIFFUSION
00115 }
|
Here is the call graph for this function:

|
|
Definition at line 87 of file log.cc. References ClearAttrs(), DiffApp::dr_, filter_callback_, handle, NRAttribute::INTEREST_CLASS, NRAttribute::IS, LOG_FILTER_PRIORITY, and NRClassAttr. Referenced by run().
00088 {
00089 NRAttrVec attrs;
00090 handle h;
00091
00092 // This is a dummy attribute for filtering that matches everything
00093 attrs.push_back(NRClassAttr.make(NRAttribute::IS, NRAttribute::INTEREST_CLASS));
00094
00095 h = ((DiffusionRouting *)dr_)->addFilter(&attrs, LOG_FILTER_PRIORITY,
00096 filter_callback_);
00097
00098 ClearAttrs(&attrs);
00099 return h;
00100 }
|
Here is the call graph for this function:

|
|
Definition at line 49 of file diffapp.cc. References DEBUG_ALWAYS, and DiffPrint(). Referenced by DiffApp::parseCommandLine().
00049 {
00050 DiffPrint(DEBUG_ALWAYS, "Usage: %s [-d debug] [-p port] [-f file] [-h]\n\n", s);
00051 DiffPrint(DEBUG_ALWAYS, "\t-d - Sets debug level (0-10)\n");
00052 DiffPrint(DEBUG_ALWAYS, "\t-p - Uses port 'port' to talk to diffusion\n");
00053 DiffPrint(DEBUG_ALWAYS, "\t-f - Specifies a config file\n");
00054 DiffPrint(DEBUG_ALWAYS, "\t-h - Prints this information\n");
00055 DiffPrint(DEBUG_ALWAYS, "\n");
00056 exit(0);
00057 }
|
Here is the call graph for this function:

|
|
Definition at line 57 of file diffapp.hh. Referenced by DiffApp::parseCommandLine(). |
|
|
Definition at line 56 of file diffapp.hh. Referenced by GeoRoutingFilter::GeoRoutingFilter(), GradientFilter::GradientFilter(), DiffApp::parseCommandLine(), PingSenderApp::PingSenderApp(), PushSenderApp::PushSenderApp(), and SrcRtFilter::SrcRtFilter(). |
|
|
|
Definition at line 61 of file log.hh. Referenced by setupFilter(). |
|
|
|
1.3.3