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


Definition at line 64 of file log.hh.
Public Member Functions | |
| LogFilter (int argc, char **argv) | |
| void | recv (Message *msg, handle h) |
| void | run () |
Protected Member Functions | |
| void | parseCommandLine (int argc, char **argv) |
| void | ProcessMessage (Message *msg) |
| handle | setupFilter () |
| void | usage (char *s) |
Protected Attributes | |
| char * | config_file_ |
| u_int16_t | diffusion_port_ |
| NR * | dr_ |
| LogFilterReceive * | filter_callback_ |
| handle | filter_handle_ |
|
||||||||||||
|
Definition at line 140 of file log.cc. References NR::createNR(), DEBUG_ALWAYS, and DiffPrint(). 00142 { 00143 // Create Diffusion Routing class 00144 #ifndef NS_DIFFUSION 00145 parseCommandLine(argc, argv); 00146 dr_ = NR::createNR(diffusion_port_); 00147 #endif // !NS_DIFFUSION 00148 00149 filter_callback_ = new LogFilterReceive(this); 00150 00151 #ifndef NS_DIFFUSION 00152 // Set up the filter 00153 filter_handle_ = setupFilter(); 00154 DiffPrint(DEBUG_ALWAYS, "Log filter subscribed to *, received handle %d\n", filter_handle_); 00155 DiffPrint(DEBUG_ALWAYS, "Log filter initialized !\n"); 00156 #endif // !NS_DIFFUSION 00157 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Reimplemented in GearReceiverApp, and GearSenderApp. Definition at line 76 of file diffapp.cc. References DiffApp::config_file_, DEBUG_ALWAYS, DEFAULT_DIFFUSION_PORT, DiffPrint(), DiffApp::diffusion_port_, global_debug_level, optarg, and DiffApp::usage(). Referenced by GeoRoutingFilter::GeoRoutingFilter(), GradientFilter::GradientFilter(), OnePhasePullFilter::OnePhasePullFilter(), RmstFilter::RmstFilter(), RmstSink::RmstSink(), and SrcRtFilter::SrcRtFilter(). 00077 { 00078 u_int16_t diff_port = DEFAULT_DIFFUSION_PORT; 00079 int debug_level; 00080 int opt; 00081 00082 config_file_ = NULL; 00083 opterr = 0; 00084 00085 while (1){ 00086 opt = getopt(argc, argv, "f:hd:p:"); 00087 switch (opt){ 00088 00089 case 'p': 00090 00091 diff_port = (u_int16_t) atoi(optarg); 00092 if ((diff_port < 1024) || (diff_port >= 65535)){ 00093 DiffPrint(DEBUG_ALWAYS, "Error: Diffusion port must be between 1024 and 65535 !\n"); 00094 exit(-1); 00095 } 00096 00097 break; 00098 00099 case 'h': 00100 00101 usage(argv[0]); 00102 00103 break; 00104 00105 case 'd': 00106 00107 debug_level = atoi(optarg); 00108 00109 if (debug_level < 1 || debug_level > 10){ 00110 DiffPrint(DEBUG_ALWAYS, "Error: Debug level outside range or missing !\n"); 00111 usage(argv[0]); 00112 } 00113 00114 global_debug_level = debug_level; 00115 00116 break; 00117 00118 case 'f': 00119 00120 if (!strncasecmp(optarg, "-", 1)){ 00121 DiffPrint(DEBUG_ALWAYS, "Error: Parameter missing !\n"); 00122 usage(argv[0]); 00123 } 00124 00125 config_file_ = strdup(optarg); 00126 00127 break; 00128 00129 case '?': 00130 00131 DiffPrint(DEBUG_ALWAYS, 00132 "Error: %c isn't a valid option or its parameter is missing !\n", optopt); 00133 usage(argv[0]); 00134 00135 break; 00136 00137 case ':': 00138 00139 DiffPrint(DEBUG_ALWAYS, "Parameter missing !\n"); 00140 usage(argv[0]); 00141 00142 break; 00143 00144 } 00145 00146 if (opt == -1) 00147 break; 00148 } 00149 00150 diffusion_port_ = diff_port; 00151 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 88 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(). 00089 { 00090 DiffPrint(DEBUG_ALWAYS, "Received a"); 00091 00092 if (msg->new_message_) 00093 DiffPrint(DEBUG_ALWAYS, " new "); 00094 else 00095 DiffPrint(DEBUG_ALWAYS, "n old "); 00096 00097 if (msg->last_hop_ != LOCALHOST_ADDR) 00098 DiffPrint(DEBUG_ALWAYS, "%s message from node %d, %d bytes\n", 00099 msg_types[msg->msg_type_], msg->last_hop_, 00100 CalculateSize(msg->msg_attr_vec_)); 00101 else 00102 DiffPrint(DEBUG_ALWAYS, "%s message from agent %d, %d bytes\n", 00103 msg_types[msg->msg_type_], msg->source_port_, 00104 CalculateSize(msg->msg_attr_vec_)); 00105 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 75 of file log.cc. References DEBUG_ALWAYS, DiffPrint(), DiffApp::dr_, filter_handle_, and ProcessMessage(). Referenced by LogFilterReceive::recv(). 00076 { 00077 if (h != filter_handle_){ 00078 DiffPrint(DEBUG_ALWAYS, 00079 "Error: recv received message for handle %d when subscribing to handle %d !\n", h, filter_handle_); 00080 return; 00081 } 00082 00083 ProcessMessage(msg); 00084 00085 ((DiffusionRouting *)dr_)->sendMessage(msg, h); 00086 }
Here is the call graph for this function: ![]() |
|
|
Implements DiffApp. Definition at line 122 of file log.cc. References DEBUG_ALWAYS, DiffPrint(), filter_handle_, and setupFilter(). Referenced by main(). 00123 { 00124 #ifdef NS_DIFFUSION 00125 filter_handle_ = setupFilter(); 00126 DiffPrint(DEBUG_ALWAYS, "Log filter subscribed to *, received handle %d\n", 00127 filter_handle_); 00128 DiffPrint(DEBUG_ALWAYS, "Log filter initialized !\n"); 00129 #else 00130 // Doesn't do anything 00131 while (1){ 00132 sleep(1000); 00133 } 00134 #endif // NS_DIFFUSION 00135 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 107 of file log.cc. References ClearAttrs(), DiffApp::dr_, filter_callback_, NRAttribute::INTEREST_CLASS, NRAttribute::IS, LOG_FILTER_PRIORITY, and NRClassAttr. Referenced by run(). 00108 { 00109 NRAttrVec attrs; 00110 handle h; 00111 00112 // This is a dummy attribute for filtering that matches everything 00113 attrs.push_back(NRClassAttr.make(NRAttribute::IS, NRAttribute::INTEREST_CLASS)); 00114 00115 h = ((DiffusionRouting *)dr_)->addFilter(&attrs, LOG_FILTER_PRIORITY, 00116 filter_callback_); 00117 00118 ClearAttrs(&attrs); 00119 return h; 00120 }
Here is the call graph for this function: ![]() |
|
|
Reimplemented in GearReceiverApp, and GearSenderApp. Definition at line 66 of file diffapp.cc. References DEBUG_ALWAYS, and DiffPrint(). Referenced by DiffApp::parseCommandLine(). 00066 { 00067 DiffPrint(DEBUG_ALWAYS, "Usage: %s [-d debug] [-p port] [-f file] [-h]\n\n", s); 00068 DiffPrint(DEBUG_ALWAYS, "\t-d - Sets debug level (0-10)\n"); 00069 DiffPrint(DEBUG_ALWAYS, "\t-p - Uses port 'port' to talk to diffusion\n"); 00070 DiffPrint(DEBUG_ALWAYS, "\t-f - Specifies a config file\n"); 00071 DiffPrint(DEBUG_ALWAYS, "\t-h - Prints this information\n"); 00072 DiffPrint(DEBUG_ALWAYS, "\n"); 00073 exit(0); 00074 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 79 of file diffapp.hh. Referenced by GearSenderApp::parseCommandLine(), GearReceiverApp::parseCommandLine(), and DiffApp::parseCommandLine(). |
|
|
|
|
Definition at line 81 of file log.hh. Referenced by setupFilter(). |
|
|
|
1.4.6