FACT++  1.0
void DimDnsServiceList::HandlerServiceListImp ( const EventImp evt)
private

Definition at line 47 of file DimState.cc.

References Service::format, EventImp::GetSize(), EventImp::GetString(), EventImp::GetTime(), Service::iscmd, Service::name, Service::server, Service::service, str, time, and type.

48 {
49  if (evt.GetSize()==0)
50  return;
51 
52  // Get the name of the service
53  //const string svc = getInfo()->getName();
54 
55  // Get the server name from the service name
56  //const string server = svc.substr(0, svc.find_first_of('/'));
57  //const string service = svc.substr(svc.find_first_of('/')+1);
58 
59  msg = evt.GetString();
60  time = evt.GetTime();
61 
62  // Initialize the entry with an empty list
63  //if (msg[0]!='+' && msg[0]!='-')
64  // return;
65 
66  typedef char_separator<char> separator;
67  const tokenizer<separator> tok(msg, separator("\n"));
68 
69  for (auto it=tok.begin(); it!=tok.end(); it++)
70  {
71  string str = *it;
72 
73  if (str[0]=='-')
74  continue;
75 
76  if (str[0]=='+')
77  str = str.substr(1);
78 
79  const size_t last_pipe = str.find_last_of('|');
80 
81  // Get the type and compare it with fType
82  const string type = str.substr(last_pipe+1);
83  if (type=="RPC")
84  continue;
85 
86  //const bool iscmd = type=="CMD";
87  //if (type!=fType && fType!="*")
88  // continue;
89 
90  const size_t first_pipe = str.find_first_of('|');
91  const size_t first_slash = str.find_first_of('/');
92 
93  // Get format, name and command name
94  Service service;
95  service.server = str.substr(0, first_slash);
96  service.name = str.substr(0, first_pipe);
97  service.service = str.substr(first_slash+1, first_pipe-first_slash-1);
98  service.format = str.substr(first_pipe +1, last_pipe -first_pipe -1);
99  service.iscmd = type=="CMD";
100 
101  const auto v = find(fServiceList.begin(), fServiceList.end(), service.name);
102  if (v!=fServiceList.end())
103  continue;
104 
105  CallbackServiceAdd(service);
106  }
107 }
bool iscmd
Definition: Service.h:10
std::string format
Definition: Service.h:9
std::vector< std::string > fServiceList
Definition: DimState.h:396
std::string server
Definition: Service.h:7
char str[80]
Definition: test_client.c:7
std::string service
Definition: Service.h:8
std::string GetString() const
Definition: EventImp.cc:194
std::string msg
Definition: DimState.h:360
int type
virtual Time GetTime() const
Definition: EventImp.h:57
std::string name
Definition: Service.h:6
virtual void CallbackServiceAdd(const Service &service)
Definition: DimState.h:431
virtual size_t GetSize() const
Definition: EventImp.h:55

+ Here is the call graph for this function: