EpcTools
An event based multi-threaded C++ development framework.
efd.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2017 Sprint
3 * Copyright (c) 2019 Sprint
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 
18 #ifndef __EFD_H
19 #define __EFD_H
20 
141 
142 #include <stddef.h>
143 #include <string.h>
144 #include <arpa/inet.h>
145 #include <time.h>
146 
147 #include <stdexcept>
148 #include <string>
149 #include <list>
150 #include <map>
151 
152 #include "freeDiameter/freeDiameter-host.h"
153 #include "freeDiameter/libfdcore.h"
154 #include "freeDiameter/libfdproto.h"
155 
156 #include "ebase.h"
157 #include "estring.h"
158 #include "etime.h"
159 #include "etimer.h"
160 #include "eutil.h"
161 
163 class FDException : public std::runtime_error
164 {
165 public:
170  FDException(const char *m) : std::runtime_error(m) {}
175  FDException(const std::string &m) : std::runtime_error(m) {}
176 };
177 
180 
181 template<class T>
182 class FDBuffer
183 {
184 public:
185  FDBuffer(size_t size) { msize = size; mbuf = new T[msize]; }
186  ~FDBuffer() { if (mbuf) delete [] mbuf; }
187  T *get() { return mbuf; }
188 private:
189  FDBuffer();
190  size_t msize;
191  T *mbuf;
192 };
193 
196 
198 class FDEngine
199 {
200 public:
205  FDEngine( const char *cfgfile = NULL );
210  FDEngine( const std::string &cfgfile );
212  ~FDEngine();
213 
217  Bool init();
221  Bool start();
223  Void uninit( Bool wait = true );
225  Void waitForShutdown();
226 
229  const EString &getConfigFile() { return m_cfgfile; }
233  const EString &setConfigFile( const char *cf ) { return m_cfgfile = cf; }
237  const EString &setConfigFile( const std::string &cf ) { return setConfigFile( cf.c_str() ); }
238 
244  Void advertiseSupport( FDDictionaryEntryApplication &app, Int auth = 0, Int acct = 0 );
251  Void advertiseSupport( FDDictionaryEntryApplication &app, FDDictionaryEntryVendor &vendor, Int auth=0, Int acct=0 );
252 private:
253  EString m_cfgfile;
254 };
255 
258 
262 {
263 public:
266  struct dictionary *getDictionary() const { return m_dict; }
269  struct dict_object *getEntry() const { return m_de; }
272  Bool isValid() { return m_de != NULL; }
273 
274 protected:
282  FDDictionaryEntry( const Void *what, enum dict_object_type type, Int criteria, struct dictionary *dict = NULL );
283 
289  Void init( const Void *what, enum dict_object_type type, Int criteria, struct dictionary *dict = NULL );
293  Void init( struct dict_object *de, struct dictionary *dict = NULL );
294 
296  virtual ~FDDictionaryEntry();
297 
298 private:
299 
300  struct dictionary *m_dict;
301  struct dict_object *m_de;
302  Bool m_destroy;
303 };
304 
306 
309 {
310 public:
311 
316  FDDictionaryEntryApplication( const char *name, struct dictionary *dict = NULL );
317 
320  const char *getName() const { return m_data.application_name; }
323  application_id_t getId() const { return m_data.application_id; }
324 
325 private:
326  Bool init();
327 
328  dict_application_data m_data;
329 };
330 
332 
335 {
336 public:
341  FDDictionaryEntryVendor( const char *name, struct dictionary *dict = NULL );
346  FDDictionaryEntryVendor( vendor_id_t vendorid, struct dictionary *dict = NULL );
351  FDDictionaryEntryVendor( const FDDictionaryEntryApplication &app, struct dictionary *dict = NULL );
352 
355  const char *getName() { return m_data.vendor_name; }
358  vendor_id_t getId() { return m_data.vendor_id; }
359 
360 private:
361  Bool init();
362 
363  dict_vendor_data m_data;
364 };
365 
367 
370 {
403 };
404 
407 {
408 public:
414  FDDictionaryEntryAVP( const char *name, Bool allVendors = false, struct dictionary *dict = NULL );
420  FDDictionaryEntryAVP( const char *name, vendor_id_t vendorid, struct dictionary *dict = NULL );
424  FDDictionaryEntryAVP( struct dict_object *de );
425 
428  Bool isDerived() const { return m_isderived; }
429 
432  const char *getName() const { return m_basedata.avp_name; }
435  vendor_id_t getVendorId() const { return m_basedata.avp_vendor; }
438  avp_code_t getAvpCode() const { return m_basedata.avp_code; }
441  DiameterDataType getDataType() const { return m_datatype; }
442 
443 private:
444  Void getTypeInfo();
445 
446  std::string m_name;
447  vendor_id_t m_vendorid;
448 
449  struct dict_avp_data m_basedata;
450  struct dict_object *m_derivedtype;
451  struct dict_type_data m_derivedtypedata;
452 
453  Bool m_isderived;
454  DiameterDataType m_datatype;
455 };
456 
458 
461 {
462 public:
467  FDDictionaryEntryCommand( const char *name, struct dictionary *dict = NULL );
472  FDDictionaryEntryCommand( command_code_t cmdid, struct dictionary *dict = NULL );
477  FDDictionaryEntryCommand( const FDDictionaryEntryCommand &req, struct dictionary *dict = NULL );
478 
481  Bool isRequest() const { return ( m_data.cmd_flag_val & CMD_FLAG_REQUEST ) ? true : false; }
484  Bool isAnswer() const { return ( m_data.cmd_flag_val & CMD_FLAG_REQUEST ) ? false : true; }
485 
488  command_code_t getCommandCode() { return m_data.cmd_code; }
491  const char *getName() { return m_data.cmd_name; }
492 
493 private:
494  struct dict_cmd_data m_data;
495 };
496 
499 
500 class FDMessage;
501 class FDExtractor;
502 class FDExtractorList;
503 class FDExtractorAvp;
504 class FDExtractorAvpList;
505 
507 class FDAvp
508 {
509  friend FDMessage;
510 
511 public:
516  FDAvp( FDDictionaryEntryAVP &de, Bool dedel = false );
522  FDAvp( FDDictionaryEntryAVP &de, struct avp *a, Bool dedel = false );
523 
525  ~FDAvp();
526 
531  FDAvp &add( FDAvp &avp );
532 
535  Bool isValid() { return m_avp != NULL; }
536 
542  FDAvp &add( FDDictionaryEntryAVP &de, int32_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
548  FDAvp &add( FDDictionaryEntryAVP &de, int64_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
554  FDAvp &add( FDDictionaryEntryAVP &de, uint32_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
560  FDAvp &add( FDDictionaryEntryAVP &de, uint64_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
566  FDAvp &add( FDDictionaryEntryAVP &de, float v ) { FDAvp avp( de ); avp = v; return add( avp ); }
572  FDAvp &add( FDDictionaryEntryAVP &de, double v ) { FDAvp avp( de ); avp = v; return add( avp ); }
578  FDAvp &add( FDDictionaryEntryAVP &de, const char *v ) { FDAvp avp( de ); avp = v; return add( avp ); }
584  FDAvp &add( FDDictionaryEntryAVP &de, const std::string &v ) { FDAvp avp( de ); avp = v; return add( avp ); }
591  FDAvp &add( FDDictionaryEntryAVP &de, const char *v, size_t len ) { FDAvp avp( de ); avp.set( v, len ); return add( avp ); }
598  FDAvp &add( FDDictionaryEntryAVP &de, const uint8_t *v, size_t len ) { FDAvp avp( de ); avp.set( v, len ); return add( avp ); }
604  FDAvp &add( FDDictionaryEntryAVP &de, const ETime &v ) { FDAvp avp( de ); avp = v; return add( avp ); }
605 
610  FDAvp &operator=( int32_t v ) { return set( v ); }
615  FDAvp &operator=( int64_t v ) { return set( v ); }
620  FDAvp &operator=( uint32_t v ) { return set( v ); }
625  FDAvp &operator=( uint64_t v ) { return set( v ); }
630  FDAvp &operator=( float v ) { return set( v ); }
635  FDAvp &operator=( double v ) { return set( v ); }
640  FDAvp &operator=( const char *v ) { return set( v ); }
645  FDAvp &operator=( const std::string &v ) { return set( v ); }
650  FDAvp &operator=( const ETime &v ) { return set( v ); }
651 
655  Bool get( int32_t &v ) { if ( m_avphdr == NULL ) return false; v = m_avphdr->avp_value->i32; return true; }
659  Bool get( uint32_t &v ) { if ( m_avphdr == NULL ) return false; v = m_avphdr->avp_value->u32; return true; }
663  Bool get( uint64_t &v ) { if ( m_avphdr == NULL ) return false; v = m_avphdr->avp_value->u64; return true; }
667  Bool get( float &v ) { if ( m_avphdr == NULL ) return false; v = m_avphdr->avp_value->f32; return true; }
671  Bool get( double &v ) { if ( m_avphdr == NULL ) return false; v = m_avphdr->avp_value->f64; return true; }
675  Bool get( int64_t &v );
679  Bool get( std::string &v );
684  Bool get( char *data, size_t &len );
689  Bool get( uint8_t *data, size_t &len );
693  Bool get( sSS &ss );
698  Bool get( ETime &v );
699 
704  FDAvp &set( int32_t v ) { m_value.i32 = v; assignValue(); return *this; }
709  FDAvp &set( uint32_t v ) { m_value.u32 = v; assignValue(); return *this; }
714  FDAvp &set( uint64_t v ) { m_value.u64 = v; assignValue(); return *this; }
719  FDAvp &set( float v ) { m_value.f32 = v; assignValue(); return *this; }
724  FDAvp &set( double v ) { m_value.f64 = v; assignValue(); return *this; }
729  FDAvp &set( const char *v ) { return set( v, strlen( v ) ); }
735  FDAvp &set( const uint8_t *v, size_t len ) { m_value.os.data = (uint8_t*)v; m_value.os.len = len; assignValue(); return *this; }
740  FDAvp &set( const std::string &v ) { return set( v.c_str(), v.size() ); }
745  FDAvp &set( int64_t v );
751  FDAvp &set( const char *v, size_t len );
755  FDAvp &set( const ETime& v );
756 
761  FDAvp getNext( Bool &found );
766  FDAvp getChild( Bool &found );
767 
770  struct avp *getAvp() { return m_avp; }
773  union avp_value *getAvpValue() { return &m_value; }
776  FDAvp &setAvp( struct avp *a );
777 
782  FDAvp &add( FDExtractor &e );
787  FDAvp &add( FDExtractorList &el );
792  FDAvp &add( FDExtractorAvp &ea );
797  FDAvp &add( FDExtractorAvpList &eal );
798 
803  FDAvp &addJson( const char *json );
808  FDAvp &addJson( const std::string &json ) { return addJson( json.c_str() ); }
812  Bool getJson( std::string &json );
813 
815  Void dump();
816 
820 
821 protected:
825  Void addTo( msg_or_avp *reference );
826 
827 private:
828  Void init();
829  Void assignValue();
830 
831  FDDictionaryEntryAVP *m_de;
832  FDBuffer<uint8_t> *m_buf;
833  Bool m_assigned;
834  struct avp *m_avp;
835  struct avp_hdr *m_avphdr;
836  Bool m_dedel;
837  union avp_value m_value;
838 };
839 
840 class FDMessageRequest;
841 class FDMessageAnswer;
842 
845 {
846 public:
848 
853  FDMessage &add( FDAvp &avp ) { avp.addTo( m_msg ); return *this; }
859  FDMessage &add( FDDictionaryEntryAVP &de, int32_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
865  FDMessage &add( FDDictionaryEntryAVP &de, int64_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
871  FDMessage &add( FDDictionaryEntryAVP &de, uint32_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
877  FDMessage &add( FDDictionaryEntryAVP &de, uint64_t v ) { FDAvp avp( de ); avp = v; return add( avp ); }
883  FDMessage &add( FDDictionaryEntryAVP &de, float v ) { FDAvp avp( de ); avp = v; return add( avp ); }
889  FDMessage &add( FDDictionaryEntryAVP &de, double v ) { FDAvp avp( de ); avp = v; return add( avp ); }
895  FDMessage &add( FDDictionaryEntryAVP &de, const char *v ) { FDAvp avp( de ); avp = v; return add( avp ); }
901  FDMessage &add( FDDictionaryEntryAVP &de, const std::string &v ) { FDAvp avp( de ); avp = v; return add( avp ); }
908  FDMessage &add( FDDictionaryEntryAVP &de, const char *v, size_t len ) { FDAvp avp( de ); avp.set( v, len ); return add( avp ); }
915  FDMessage &add( FDDictionaryEntryAVP &de, const uint8_t *v, size_t len ) { FDAvp avp( de ); avp.set( v, len ); return add( avp ); }
921  FDMessage &add( FDDictionaryEntryAVP &de, const ETime &v ) { FDAvp avp( de ); avp = v; return add( avp ); }
922 
927  FDMessage &add( FDExtractor &e );
932  FDMessage &add( FDExtractorList &el );
937  FDMessage &add( FDExtractorAvp &ea );
943 
949  Bool get( FDDictionaryEntryAVP &de, int32_t &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
955  Bool get( FDDictionaryEntryAVP &de, int64_t &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
961  Bool get( FDDictionaryEntryAVP &de, uint32_t &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
967  Bool get( FDDictionaryEntryAVP &de, uint64_t &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
973  Bool get( FDDictionaryEntryAVP &de, float &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
979  Bool get( FDDictionaryEntryAVP &de, double &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
985  Bool get( FDDictionaryEntryAVP &de, std::string &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
992  Bool get( FDDictionaryEntryAVP &de, char *v, size_t &len ) { FDAvp avp = findAVP( de ); return avp.get( v, len ); }
999  Bool get( FDDictionaryEntryAVP &de, uint8_t *v, size_t &len ) { FDAvp avp = findAVP( de ); return avp.get( v, len ); }
1005  Bool get( FDDictionaryEntryAVP &de, ETime &v ) { FDAvp avp = findAVP( de ); return avp.get( v ); }
1006 
1016  FDAvp getFirstAVP( Bool &found );
1017 
1019  Void dump();
1020 
1023  Bool isRequest() { return m_de->isRequest(); }
1026  Bool isAnswer() { return m_de->isAnswer(); }
1027 
1030  struct msg *getMsg() { return m_msg; }
1031 
1034  Void addOrigin();
1035 
1040  FDMessage &addJson( const char *json );
1045  FDMessage &addJson( const std::string &json ) { return addJson( json.c_str() ); }
1049  Bool getJson( std::string &json );
1050 
1051 protected:
1059  FDMessage( Bool req2ans, FDDictionaryEntryCommand *de, struct msg *pmsg = NULL, Bool dedel = false, Bool msgdel = true );
1065  FDMessage( FDDictionaryEntryCommand *de, struct msg *pmsg = NULL, Bool dedel = false );
1072  FDMessage( FDDictionaryEntryApplication *ade, FDDictionaryEntryCommand *cde, struct msg *pmsg = NULL, Bool dedel = false );
1074  ~FDMessage();
1075 
1081  FDMessage &sendRequest( Void (*anscb)(Void*,struct msg**), FDMessageRequest &req );
1085  FDMessage &sendAnswer();
1086 
1089  Void setMsgDelete( Bool v ) { m_msgdel = v; }
1090 
1091 private:
1092  FDMessage();
1093 
1095  struct msg *m_msg;
1096  Bool m_dedel;
1097  Bool m_msgdel;
1098  struct dict_cmd_data m_basedata;
1099 };
1100 
1103 {
1104  friend FDMessageRequest;
1105 
1106 public:
1111  FDMessageAnswer( FDMessageRequest *req, struct msg *pmsg ); // used to encapsulate a FD answer message
1115  FDMessageAnswer( FDMessageRequest *req ); // used to create and encapsulate a FD answer from a request
1117  ~FDMessageAnswer();
1118 
1122  FDMessageAnswer &send();
1123 
1124 private:
1125  FDMessageRequest *m_request;
1126 };
1127 
1130 {
1131  friend FDMessageAnswer;
1132 
1133 public:
1142  FDMessageRequest( FDDictionaryEntryCommand *cde, struct msg *pmsg );
1148  virtual ~FDMessageRequest();
1149 
1154 
1157  virtual Void processAnswer( FDMessageAnswer &ans );
1158 
1161  Bool setPreserveAnswer(Bool preserve) { return m_preserve_answer = preserve; }
1164  Bool getPreserveAnswer() { return m_preserve_answer; }
1165 
1166 protected:
1168 
1169 private:
1170  static Void anscb( Void * data, struct msg ** pmsg );
1171 
1172  Bool m_preserve_answer;
1173 };
1174 
1177 {
1178 public:
1182 
1185  virtual Bool isRequest() = 0;
1188  Bool isAnswer() { return !isRequest(); }
1189 
1190 protected:
1194 
1195 private:
1196  FDCommand();
1197 
1199 };
1200 
1203 {
1204 public:
1208 
1211  Bool isRequest() { return true; }
1212 
1215  virtual Int process( FDMessageRequest *req ) = 0;
1216 };
1217 
1219 #define FDISREQUEST(hdr) ((hdr->msg_flags & CMD_FLAG_REQUEST) == CMD_FLAG_REQUEST)
1220 #define FDISANSWER(hdr) ((hdr->msg_flags & CMD_FLAG_REQUEST) != CMD_FLAG_REQUEST)
1221 
1225 {
1226 public:
1231  ~FDApplication();
1232 
1236 
1241 
1242 protected:
1244  FDApplication() : m_de( NULL ) {}
1248 
1249 private:
1250 
1251  static Int commandcb( struct msg **m, struct avp *avp, struct session *session, Void *data, enum disp_action *action );
1252 
1254  std::list<FDCommandRequest*> m_cmds;
1255 };
1256 
1259 
1262 {
1263 public:
1265  FDSession();
1267  ~FDSession();
1268 
1271  const EString &getSessionId();
1275  Void addSessionId( FDMessage &msg, FDDictionaryEntryAVP &deSessionId );
1276 
1277 private:
1278  Void init();
1279 
1280  struct session *m_session;
1281  EString m_sid;
1282 };
1283 
1286 
1289 {
1293  PSNew = 0,
1318 };
1319 
1321 class FDPeer
1322 {
1323 public:
1325  FDPeer();
1329  FDPeer( DiamId_t diamid, uint16_t port = 3868 );
1333  FDPeer( const std::string &diamid, uint16_t port = 3868 );
1334 
1337  const std::string &getDiameterId() { return m_diamid; }
1341  FDPeer &setDiameterId( DiamId_t diamid ) { m_diamid = diamid; return *this; }
1342 
1345  uint16_t getPort() { return m_port; }
1349  FDPeer &setPort( uint16_t v ) { m_port = v; return *this; }
1350 
1353  const EString &getDestinationHost() const { return m_diamid; }
1356  const EString &getDestinationRealm() const { return m_destrealm; }
1357 
1361  const EString &setDestinationIp( const char *ip ) { m_destip = ip; return getDestinationIp(); }
1365  const EString &setDestinationIp( const std::string &ip ) { m_destip = ip; return getDestinationIp(); }
1368  const EString &getDestinationIp() const { return m_destip; }
1369 
1373 
1376  Bool isOpen() { return getState() == PSOpen; }
1377 
1379  Void add();
1380 
1381 private:
1382  Void init();
1383  static Void peercb( struct peer_info *pi, Void *data );
1384 
1385  EString m_diamid;
1386  EString m_destrealm;
1387  EString m_destip;
1388  uint16_t m_port;
1389  struct peer_hdr *m_peer;
1390 };
1391 
1393 class FDPeerList : public std::list<FDPeer*>
1394 {
1395 public:
1397  FDPeerList();
1399  ~FDPeerList();
1400 
1403  Bool isPeerOpen();
1404 
1407  FDPeer *getOpenPeer();
1408 };
1409 
1412 
1413 class FDExtractorAvp;
1414 
1417 {
1426 };
1427 
1430 {
1431 public:
1435  : m_de( de ),
1436  m_idx( -1 ),
1437  m_resolved( false )
1438  {
1439  }
1440 
1443  {
1444  }
1445 
1448  virtual eFDExtractorType getExtractorType() = 0;
1449 
1452  Int getIndex() { return m_idx; }
1456  Int setIndex( Int idx ) { return m_idx = idx; }
1457 
1460  Bool getResolved() { return m_resolved; }
1464  Bool setResolved( Bool resolved = true ) { return m_resolved = resolved; }
1465 
1468  Bool exists() { return m_idx != -1; }
1469 
1473 
1474 private:
1475  FDDictionaryEntryAVP *m_de;
1476  Int m_idx;
1477  Bool m_resolved;
1478 };
1479 
1482 {
1483 public:
1486  : m_vndid( 0 ),
1487  m_avpcode( 0 )
1488  {
1489  }
1490 
1494  FDExtractorKey( vendor_id_t v, avp_code_t a )
1495  : m_vndid( v ),
1496  m_avpcode( a )
1497  {
1498  }
1499 
1503  : m_vndid( k.m_vndid ),
1504  m_avpcode( k.m_avpcode )
1505  {
1506  }
1507 
1510  {
1511  }
1512 
1516  Bool operator <(const FDExtractorKey &rval ) const
1517  {
1518  return
1519  m_vndid < rval.m_vndid ? True :
1520  m_vndid > rval.m_vndid ? False : m_avpcode < rval.m_avpcode;
1521  }
1522 
1525  vendor_id_t getVendor() { return m_vndid; }
1529  vendor_id_t setVendor( vendor_id_t v ) { return m_vndid = v; }
1530 
1533  avp_code_t getAvpCode() { return m_avpcode; }
1537  avp_code_t setAvpCode( avp_code_t a ) { return m_avpcode = a; }
1538 
1539 private:
1540  vendor_id_t m_vndid;
1541  avp_code_t m_avpcode;
1542 };
1543 
1546 {
1547  friend FDExtractorList;
1548  friend FDExtractorAvp;
1549  friend FDExtractorAvpList;
1550 
1551 public:
1553  FDExtractor();
1556  FDExtractor( FDMessage &msg );
1565  virtual ~FDExtractor();
1566 
1570 
1573  Void setReference( FDMessage &msg ) { m_reference = msg.getMsg(); }
1576  Void setReference( FDAvp &avp ) { m_reference = avp.getAvp(); }
1579  Void setReference( msg_or_avp *m ) { m_reference = m; }
1580 
1583  FDExtractor *getParent() { return m_parent; }
1586  msg_or_avp *getReference();
1587 
1589  Void add( FDExtractorBase &base );
1590 
1593  Bool exists( Bool skipResolve = false );
1594 
1596  Void dump();
1597 
1601  Bool getJson( std::string &json );
1602 
1603 protected:
1605  Void resolve();
1606 
1607 private:
1608  FDExtractor *m_parent;
1609  msg_or_avp *m_reference;
1610  std::map<FDExtractorKey,FDExtractorBase*> m_entries;
1611  Int m_index;
1612 };
1613 
1616 {
1617  friend FDExtractor;
1618  friend FDAvp;
1619  friend FDMessage;
1620 
1621 public:
1627  virtual ~FDExtractorList();
1628 
1632 
1635  FDExtractor &getParent() { return *m_parent; }
1636 
1639  virtual FDExtractor *createExtractor() = 0;
1640 
1643  Void addExtractor( FDExtractor *e );
1644 
1647  Bool exists();
1648 
1650  Void dump();
1651 
1652 protected:
1655  std::list<FDExtractor*> &getList();
1656 
1657 private:
1658  FDExtractorList();
1659 
1660  FDExtractor *m_parent;
1661  std::list<FDExtractor*> m_list;
1662 };
1663 
1666 {
1667 public:
1672  FDExtractorAvp( FDExtractor &extractor, FDDictionaryEntryAVP &de, Bool dedel = false );
1674  virtual ~FDExtractorAvp();
1675 
1679 
1682  Void setAvp( struct avp *a ) { m_avp.setAvp( a ); }
1685  struct avp *getAvp() { return m_avp.getAvp(); }
1688  union avp_value *getAvpValue() { return m_avp.getAvpValue(); }
1689 
1692  Bool exists();
1693 
1697  Bool get( int32_t &v ) { if ( !exists() ) return false; return m_avp.get( v ); }
1701  Bool get( uint32_t &v ) { if ( !exists() ) return false; return m_avp.get( v ); }
1705  Bool get( uint64_t &v ) { if ( !exists() ) return false; return m_avp.get( v ); }
1709  Bool get( float &v ) { if ( !exists() ) return false; return m_avp.get( v ); }
1713  Bool get( double &v ) { if ( !exists() ) return false; return m_avp.get( v ); }
1717  Bool get( int64_t &v ) { if ( !exists() ) return false; return m_avp.get( v ); }
1721  Bool get( std::string &v ) { if ( !exists() ) return false; return m_avp.get( v ); }
1726  Bool get( char *data, size_t &len ) { if ( !exists() ) return false; return m_avp.get( data, len ); }
1731  Bool get( uint8_t *data, size_t &len ) { if ( !exists() ) return false; return m_avp.get( data, len ); }
1735  Bool get( sSS &ss ) { if ( !exists() ) return false; return m_avp.get( ss ); }
1740  Bool get( ETime &t ) { if ( !exists() ) return false; return m_avp.get( t ); }
1741 
1743  Void dump();
1744 
1748  Bool getJson( std::string &json );
1749 
1750 private:
1751  FDExtractor &m_extractor;
1752  FDAvp m_avp;
1753 };
1754 
1757 {
1758 public:
1764  virtual ~FDExtractorAvpList();
1765 
1769 
1772  std::list<FDExtractorAvp*> &getList();
1773 
1776  Bool exists();
1777 
1779  Void dump();
1780 
1781 private:
1783 
1784  FDExtractor *m_parent;
1785  std::list<FDExtractorAvp*> m_list;
1786 };
1787 
1790 
1792 class FDHook
1793 {
1794 public:
1796  FDHook();
1797 
1804  virtual Void process(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer,
1805  Void * other, struct fd_hook_permsgdata *pmd) = 0;
1806 
1808  Bool registerHook(UInt hookmask);
1810  Void unregisterHook();
1811 
1814  struct fd_hook_hdl *getHandle() { return m_hdl; }
1815 
1818  UInt getHookMask() { return m_hookmask; }
1819 
1820 private:
1821  static Void hook_cb(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer,
1822  Void * other, struct fd_hook_permsgdata *pmd, Void * regdata);
1823 
1824  UInt m_hookmask;
1825  struct fd_hook_hdl *m_hdl;
1826 };
1827 
1830 
1833 {
1834 public:
1839  static Void splitDiameterFQDN( std::string &fqdn, std::string &host, std::string &realm );
1844  static Void splitDiameterFQDN( const char *fqdn, std::string &host, std::string &realm ) { std::string sfqdn( fqdn ); splitDiameterFQDN( sfqdn, host, realm ); }
1845 
1852  static size_t str2tbcd( const char *src, size_t srclen, uint8_t *dst, size_t dstlen );
1858  static size_t str2tbcd( const char *src, uint8_t *dst, size_t dstlen );
1864  static size_t str2tbcd( const std::string &src, uint8_t *dst, size_t dstlen );
1865 
1872  static size_t tbcd2str( uint8_t *src, size_t srclen, char *dst, size_t dstlen );
1878  static size_t tbcd2str( uint8_t *src, size_t srclen, std::string &dst );
1879 };
1880 
1881 #endif // #define __EFD_H
FDExtractorBase::~FDExtractorBase
virtual ~FDExtractorBase()
Class destructor.
Definition: efd.h:1442
FDMessage::addJson
FDMessage & addJson(const char *json)
Adds the AVP's represented in the JSON string.
Definition: efd.cpp:1357
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, uint32_t v)
Adds an uint32_t AVP to this grouped AVP.
Definition: efd.h:554
PSOpen
Connection established.
Definition: efd.h:1295
FDAvp::getChild
FDAvp getChild(Bool &found)
Returns the first child AVP of this grouped AVP.
Definition: efd.cpp:946
FDExtractorBase::setResolved
Bool setResolved(Bool resolved=true)
Assigns the resolved state.
Definition: efd.h:1464
FDMessageRequest::FDMessageRequest
FDMessageRequest(FDDictionaryEntryCommand *cde)
Class constructor. Constructs a request to be sent.
Definition: efd.cpp:1406
FDAvp::get
Bool get(int32_t &v)
Retrieves an int32_t AVP value. Returns True if the value is successfully retrieved.
Definition: efd.h:655
FDMessageAnswer::~FDMessageAnswer
~FDMessageAnswer()
Class destructor.
Definition: efd.cpp:1373
FDExtractorAvp::get
Bool get(std::string &v)
Retrieves a string AVP value.
Definition: efd.h:1721
FDPeer::getPort
uint16_t getPort()
Retrieves the IP port for this peer.
Definition: efd.h:1345
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, float v)
Adds a float AVP to this grouped AVP.
Definition: efd.h:566
FDEngine::getConfigFile
const EString & getConfigFile()
Retrieves the configuration file name..
Definition: efd.h:229
FDDictionaryEntryAVP::FDDictionaryEntryAVP
FDDictionaryEntryAVP(const char *name, Bool allVendors=false, struct dictionary *dict=NULL)
Class constructor.
Definition: efd.cpp:361
FDAvp::getAvpValue
union avp_value * getAvpValue()
Returns the underlying freeDiameter AVP value object.
Definition: efd.h:773
FDAvp::operator=
FDAvp & operator=(const std::string &v)
Assigns a string value to this AVP.
Definition: efd.h:645
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, const std::string &v)
Adds a string to this grouped AVP.
Definition: efd.h:584
FDEngine::setConfigFile
const EString & setConfigFile(const char *cf)
Sets the configuration file.
Definition: efd.h:233
FDExtractorAvpList::getExtractorType
eFDExtractorType getExtractorType()
Retrieves the extractor type.
Definition: efd.h:1768
FDMessage::~FDMessage
~FDMessage()
Class destructor.
Definition: efd.cpp:1207
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, int64_t &v)
Retrieves the int64_t AVP value associated with specified dictionary entry.
Definition: efd.h:955
FDAvp::addJson
FDAvp & addJson(const std::string &json)
Adds the AVP's represented in a JSON string.
Definition: efd.h:808
FDExtractorKey::getAvpCode
avp_code_t getAvpCode()
Retrieves the AVP code.
Definition: efd.h:1533
FDExtractorKey::setVendor
vendor_id_t setVendor(vendor_id_t v)
Assigns the vendor ID.
Definition: efd.h:1529
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, float &v)
Retrieves the float AVP value associated with specified dictionary entry.
Definition: efd.h:973
FDAvp::~FDAvp
~FDAvp()
Class destructor.
Definition: efd.cpp:563
FDDictionaryEntryVendor
A dictionary entry object associated with a vendor.
Definition: efd.h:334
DDTDiameterURI
diameter URI
Definition: efd.h:398
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, int32_t v)
Adds an int32_t value to this message.
Definition: efd.h:859
FDDictionaryEntryCommand::FDDictionaryEntryCommand
FDDictionaryEntryCommand(const char *name, struct dictionary *dict=NULL)
Class constructor.
Definition: efd.cpp:472
DDTOctetString
octet string
Definition: efd.h:374
FDPeerList::getOpenPeer
FDPeer * getOpenPeer()
Retrieves the first peer that is an open state.
Definition: efd.cpp:1844
FDUtility::splitDiameterFQDN
static Void splitDiameterFQDN(std::string &fqdn, std::string &host, std::string &realm)
Splits a fully qualified domain name into host and realm.
Definition: efd.cpp:2228
FDBuffer::get
T * get()
Definition: efd.h:187
FDExtractorList::dump
Void dump()
Prints the underlying freeDiameter message or AVP to stdout.
FDPeer::setDiameterId
FDPeer & setDiameterId(DiamId_t diamid)
Assigns the Diameter ID for this peer object.
Definition: efd.h:1341
DDTUTF8String
UTF-8 string (derived from octet string)
Definition: efd.h:394
FDUtility
Various Diameter utility functions.
Definition: efd.h:1832
FDExtractorAvp::get
Bool get(double &v)
Retrieves a double AVP value.
Definition: efd.h:1713
FDMessage::setMsgDelete
Void setMsgDelete(Bool v)
Sets value indicating if the freeDiameter message object is to be deleted when this object is destroy...
Definition: efd.h:1089
FDAvp::set
FDAvp & set(uint32_t v)
Assigns an uint32_t value to this AVP.
Definition: efd.h:709
FDExtractor::~FDExtractor
virtual ~FDExtractor()
Class destructor.
Definition: efd.cpp:1884
FDException::FDException
FDException(const std::string &m)
Class constructor.
Definition: efd.h:175
FDMessage::sendAnswer
FDMessage & sendAnswer()
Sends an answer message;.
Definition: efd.cpp:1288
ETime
Class for manipulating date and time of day values.
Definition: etime.h:199
FDApplication::registerHandler
FDApplication & registerHandler(FDCommandRequest &cmd)
Registers a message handler for a request command.
Definition: efd.cpp:1505
FDExtractorBase::getResolved
Bool getResolved()
Retrieves the resolved status. Being resolved means that the underlying freeDiameter AVP has been loc...
Definition: efd.h:1460
FDMessageRequest::m_timer
ETimer m_timer
Definition: efd.h:1167
FDMessage::dump
Void dump()
Prints the AVP contents of this message.
Definition: efd.cpp:1255
FDExtractorAvp::getJson
Bool getJson(std::string &json)
Retrieves the JSON string representing the AVP values for this AVP.
Definition: efd.cpp:2137
PSWaitCnxAckElec
Received a CER from this same peer on an incoming connection (other peer object), while we were waiti...
Definition: efd.h:1303
FDAvp::set
FDAvp & set(const char *v)
Assigns a string value to this AVP.
Definition: efd.h:729
PSClosing
The connection is being shutdown (DPR/DPA in progress).
Definition: efd.h:1299
FDDictionaryEntryCommand::getName
const char * getName()
Returns the command name.
Definition: efd.h:491
FDDictionaryEntry::~FDDictionaryEntry
virtual ~FDDictionaryEntry()
Class destructor.
Definition: efd.cpp:272
FDCommandRequest::isRequest
Bool isRequest()
Indicates if this command is a request (based on the dictionary entry).
Definition: efd.h:1211
FDDictionaryEntryCommand
A dictionary entry object associated with a command message.
Definition: efd.h:460
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, std::string &v)
Retrieves the string AVP value associated with specified dictionary entry.
Definition: efd.h:985
FDPeer::getDestinationIp
const EString & getDestinationIp() const
Retrieves the peer's IP address.
Definition: efd.h:1368
FDExtractorAvpList
An extractor for an AVP that can have multiple occurrances.
Definition: efd.h:1756
DDTU64
64-bit unsigned integer
Definition: efd.h:382
True
#define True
True.
Definition: ebase.h:25
FDDictionaryEntryAVP::getName
const char * getName() const
Returns the AVP name.
Definition: efd.h:432
FDExtractor::add
Void add(FDExtractorBase &base)
Adds a child extractor to this extractor.
Definition: efd.cpp:1888
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, uint8_t *v, size_t &len)
Retrieves the octet string AVP value associated with specified dictionary entry.
Definition: efd.h:999
DDTI32
32-bit integer
Definition: efd.h:376
FDAvp::set
FDAvp & set(float v)
Assigns a float value to this AVP.
Definition: efd.h:719
FDExtractorAvp::getAvpValue
union avp_value * getAvpValue()
Retrieves the underlying freeDiameter AVP value pointer.
Definition: efd.h:1688
etAvp
represents an AVP extractor
Definition: efd.h:1419
FDHook::unregisterHook
Void unregisterHook()
Unregisters the hook.
Definition: efd.cpp:2205
FDBuffer
Definition: efd.h:182
FDMessageAnswer::FDMessageAnswer
FDMessageAnswer(FDMessageRequest *req, struct msg *pmsg)
Class constructor. Constructs the received answer message.
Definition: efd.cpp:1383
FDMessage::isAnswer
Bool isAnswer()
Indicates if this message is an answer.
Definition: efd.h:1026
FDExtractorList::getList
std::list< FDExtractor * > & getList()
Retrieves the extractor list.
Definition: efd.cpp:2100
DDTGrouped
grouped AVP
Definition: efd.h:388
FDAvp::getJson
Bool getJson(std::string &json)
Retrieves the JSON string representing the AVP values for this AVP.
Definition: efd.cpp:1094
FDAvp::operator=
FDAvp & operator=(uint64_t v)
Assigns an uint64_t value to this AVP.
Definition: efd.h:625
PSReOpen
Connection has been re-established, waiting for 3 DWR/DWA exchanges before putting back to service.
Definition: efd.h:1311
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, int32_t v)
Adds an int32_t AVP to this grouped AVP.
Definition: efd.h:542
FDMessage::sendRequest
FDMessage & sendRequest(Void(*anscb)(Void *, struct msg **), FDMessageRequest &req)
Sends a request message.
Definition: efd.cpp:1273
FDDictionaryEntry::getDictionary
struct dictionary * getDictionary() const
Returns the freeDiameter dictionary structure pointer.
Definition: efd.h:266
FDMessage::getMsg
struct msg * getMsg()
Retrieves the freeDiameter message pointer.
Definition: efd.h:1030
DDTU32
32-bit unsigned integer
Definition: efd.h:380
PSOpenHandshake
TLS Handshake and validation are in progress in open state – we use it only for debug purpose,...
Definition: efd.h:1307
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, double &v)
Retrieves the double AVP value associated with specified dictionary entry.
Definition: efd.h:979
FDExtractorAvp::exists
Bool exists()
Determines if this extractor exists in the underlying freeDiameter message or grouped AVP.
Definition: efd.cpp:2121
FDPeerState
FDPeerState
Peer state enumerations.
Definition: efd.h:1288
ebase.h
Macros for various standard C library functions and standard includes.
FDExtractorAvp::FDExtractorAvp
FDExtractorAvp(FDExtractor &extractor, FDDictionaryEntryAVP &de, Bool dedel=false)
Class constructor.
Definition: efd.cpp:2110
FDHook::process
virtual Void process(enum fd_hook_type type, struct msg *msg, struct peer_hdr *peer, Void *other, struct fd_hook_permsgdata *pmd)=0
Method that is called to process a freeDiameter hook callback.
FDSession::addSessionId
Void addSessionId(FDMessage &msg, FDDictionaryEntryAVP &deSessionId)
Adds the Session-Id to a message.
Definition: efd.cpp:1613
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, uint64_t v)
Adds an uint64_t AVP to this grouped AVP.
Definition: efd.h:560
FDAvp::get
Bool get(uint64_t &v)
Retrieves an uint64_t AVP value. Returns True if the value is successfully retrieved.
Definition: efd.h:663
FDExtractorAvpList::exists
Bool exists()
Determines if this extractor exists in the underlying freeDiameter message or grouped AVP.
Definition: efd.cpp:2164
FDAvp::set
FDAvp & set(uint64_t v)
Assigns an uint64_t value to this AVP.
Definition: efd.h:714
FDAvp::operator=
FDAvp & operator=(double v)
Assigns a double value to this AVP.
Definition: efd.h:635
FDCommand
Represents a command, a request or answer, that will be registered with freeDiameter.
Definition: efd.h:1176
FDAvp::FDAvp
FDAvp(FDDictionaryEntryAVP &de, Bool dedel=false)
Class constructor.
Definition: efd.cpp:531
FDBuffer::~FDBuffer
~FDBuffer()
Definition: efd.h:186
FDDictionaryEntryAVP
A dictionary entry object associated with an AVP.
Definition: efd.h:406
FDExtractorKey::operator<
Bool operator<(const FDExtractorKey &rval) const
Determins if the provided extractor key is less than this extractor key.
Definition: efd.h:1516
FDAvp::operator=
FDAvp & operator=(uint32_t v)
Assigns an uint32_t value to this AVP.
Definition: efd.h:620
PSWaitCEA
Connection established, CER sent, waiting for CEA.
Definition: efd.h:1305
FDDictionaryEntryApplication::FDDictionaryEntryApplication
FDDictionaryEntryApplication(const char *name, struct dictionary *dict=NULL)
Class constructor.
Definition: efd.cpp:279
FDAvp::add
FDAvp & add(FDAvp &avp)
Adds an AVP to this grouped AVP.
Definition: efd.cpp:575
FDDictionaryEntry::getEntry
struct dict_object * getEntry() const
Returns the freeDiameter dictionary entry structure pointer.
Definition: efd.h:269
FDExtractorKey::FDExtractorKey
FDExtractorKey(const FDExtractorKey &k)
Copy constructor.
Definition: efd.h:1502
FDCommand::isAnswer
Bool isAnswer()
Indicates if this command is an answer.
Definition: efd.h:1188
FDExtractorList::~FDExtractorList
virtual ~FDExtractorList()
Class destructor.
Definition: efd.cpp:2079
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, const uint8_t *v, size_t len)
Adds an octet string AVP to this grouped AVP.
Definition: efd.h:598
FDApplication::FDApplication
FDApplication()
Default class constructor.
Definition: efd.h:1244
FDExtractor::FDExtractor
FDExtractor()
Default constructor.
Definition: efd.cpp:1860
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, ETime &v)
Retrieves the time AVP value associated with specified dictionary entry.
Definition: efd.h:1005
etimer.h
PSClosed
No connection established, will re-attempt after TcTimer.
Definition: efd.h:1297
FDDictionaryEntryVendor::FDDictionaryEntryVendor
FDDictionaryEntryVendor(const char *name, struct dictionary *dict=NULL)
Class constructor.
Definition: efd.cpp:308
FDCommand::isRequest
virtual Bool isRequest()=0
Indicates if this command is a request (based on the dictionary entry).
FDAvp::getDictionaryEntry
FDDictionaryEntryAVP & getDictionaryEntry()
Retrieves the dictionary entry associated with this FDAvp object.
Definition: efd.h:819
FDMessage::getJson
Bool getJson(std::string &json)
Retrieves a JSON string with all of the AVP's represented in it.
Definition: efd.cpp:1364
FDExtractorList::getExtractorType
eFDExtractorType getExtractorType()
Retrieves the extractor type.
Definition: efd.h:1631
PSClosingGrace
After DPA is sent or received, give a short delay for messages in the pipe to be received.
Definition: efd.h:1315
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, const char *v)
Adds a string AVP to this grouped AVP.
Definition: efd.h:578
FDAvp::get
Bool get(double &v)
Retrieves a double AVP value.
Definition: efd.h:671
etAvpList
represents an AVP list extractor
Definition: efd.h:1421
FDExtractorAvp::get
Bool get(int64_t &v)
Retrieves an int64_t AVP value.
Definition: efd.h:1717
FDExtractorAvp::get
Bool get(uint8_t *data, size_t &len)
Retrieves an octet string AVP value.
Definition: efd.h:1731
FDExtractorKey::getVendor
vendor_id_t getVendor()
Retrieves the vendor ID.
Definition: efd.h:1525
FDDictionaryEntryCommand::isAnswer
Bool isAnswer() const
Returns True of the command is an answer.
Definition: efd.h:484
FDEngine::waitForShutdown
Void waitForShutdown()
Waits for freeDiameter to shut down.
Definition: efd.cpp:196
FDAvp::isValid
Bool isValid()
Indicates if this AVP object is valid.
Definition: efd.h:535
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, double v)
Adds a double AVP to this grouped AVP.
Definition: efd.h:572
FDMessage::findAVP
FDAvp findAVP(FDDictionaryEntryAVP &de)
Retrieves the AVP object specified by the dictionary entry from this message.
Definition: efd.cpp:1215
FDUtility::tbcd2str
static size_t tbcd2str(uint8_t *src, size_t srclen, char *dst, size_t dstlen)
Converts a TBCD value to a series of digits.
Definition: efd.cpp:2309
PSInvalid
Invalid or undefined state.
Definition: efd.h:1291
FDEngine::advertiseSupport
Void advertiseSupport(FDDictionaryEntryApplication &app, Int auth=0, Int acct=0)
Configures a Diameter application to be advertised in the CER/CEA.
Definition: efd.cpp:201
ETimer
Implements a stopwatch style timer.
Definition: etimer.h:26
FDAvp::set
FDAvp & set(int32_t v)
Assigns an int32_t value to this AVP.
Definition: efd.h:704
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, uint64_t v)
Adds an uint64_t value to this message.
Definition: efd.h:877
etime.h
Provides class for manipulating time of day values.
FDExtractor::setReference
Void setReference(FDAvp &avp)
Assigns the reference that this extractor is associated wtih.
Definition: efd.h:1576
etExtractor
represents an extractor (grouped AVP)
Definition: efd.h:1423
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, const ETime &v)
Adds a time value to this message.
Definition: efd.h:921
FDPeer
Represents a Diameter peer.
Definition: efd.h:1321
DDTF32
32-bit floating point
Definition: efd.h:384
FDExtractorAvpList::~FDExtractorAvpList
virtual ~FDExtractorAvpList()
Class destructor.
Definition: efd.cpp:2153
FDExtractorList::addExtractor
Void addExtractor(FDExtractor *e)
Adds an extractor to the list.
Definition: efd.cpp:2090
PSZombie
The PSM thread is not running anymore; it must be re-started or peer should be deleted.
Definition: efd.h:1317
False
#define False
False.
Definition: ebase.h:27
FDAvp::addTo
Void addTo(msg_or_avp *reference)
Adds the contents of the message or avp to this AVP object.
Definition: efd.cpp:974
FDExtractorBase::setIndex
Int setIndex(Int idx)
Assigns the index of this AVP.
Definition: efd.h:1456
FDPeer::setPort
FDPeer & setPort(uint16_t v)
Assigns the IP port for this peer.
Definition: efd.h:1349
FDDictionaryEntry::init
Void init(const Void *what, enum dict_object_type type, Int criteria, struct dictionary *dict=NULL)
initializes an object created with the default constructor.
Definition: efd.cpp:244
FDException
Exception base class used within the freeDiameter wrapper classes.
Definition: efd.h:163
FDExtractor::dump
Void dump()
Prints the underlying freeDiameter message or AVP to stdout.
Definition: efd.cpp:2036
FDException::FDException
FDException(const char *m)
Class constructor.
Definition: efd.h:170
FDDictionaryEntryAVP::getAvpCode
avp_code_t getAvpCode() const
Returns the AVP code/ID.
Definition: efd.h:438
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, uint32_t v)
Adds an uint32_t value to this message.
Definition: efd.h:871
FDPeerList::FDPeerList
FDPeerList()
Class constructor.
Definition: efd.cpp:1817
FDHook
Registers, unregisters and process freeDiameter hooks. See "MONITORING" in libfdcore....
Definition: efd.h:1792
FDExtractor::getExtractorType
eFDExtractorType getExtractorType()
Retrieves the extractor type.
Definition: efd.h:1569
FDUtility::splitDiameterFQDN
static Void splitDiameterFQDN(const char *fqdn, std::string &host, std::string &realm)
Splits a fully qualified domain name into host and realm.
Definition: efd.h:1844
FDExtractorAvp::getAvp
struct avp * getAvp()
Retrieves the underlying freeDiameter AVP pointer.
Definition: efd.h:1685
DDTTime
time value
Definition: efd.h:392
FDMessageAnswer
Represents a Diameter answer message (in rsponse to a request).
Definition: efd.h:1102
FDHook::FDHook
FDHook()
Class constructor.
Definition: efd.cpp:2192
FDExtractorAvp::getExtractorType
eFDExtractorType getExtractorType()
Retrieves the extractor type.
Definition: efd.h:1678
FDExtractorKey::setAvpCode
avp_code_t setAvpCode(avp_code_t a)
Assigns the AVP code.
Definition: efd.h:1537
FDDictionaryEntry::isValid
Bool isValid()
Returns true if the dictionary entry is valid.
Definition: efd.h:272
FDExtractorKey::FDExtractorKey
FDExtractorKey()
Class constructor.
Definition: efd.h:1485
FDDictionaryEntryVendor::getId
vendor_id_t getId()
Returns the vendor ID associated with the vendor.
Definition: efd.h:358
FDExtractorList
A wrapper around a grouped AVP that can occur multiple times.
Definition: efd.h:1615
FDAvp
A class wrapper around a freeDiameter AVP object.
Definition: efd.h:507
FDBuffer::FDBuffer
FDBuffer(size_t size)
Definition: efd.h:185
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, int64_t v)
Adds an int64_t AVP to this grouped AVP.
Definition: efd.h:548
FDExtractorKey::~FDExtractorKey
virtual ~FDExtractorKey()
Class destructor.
Definition: efd.h:1509
FDDictionaryEntryApplication::getName
const char * getName() const
Returns the name of the application.
Definition: efd.h:320
FDExtractorAvp::get
Bool get(uint32_t &v)
Retrieves an uint32_t AVP value. Returns True if the value is successfully retrieved.
Definition: efd.h:1701
FDHook::registerHook
Bool registerHook(UInt hookmask)
Registers the hook for the specified events.
Definition: efd.cpp:2198
FDCommand::getDictionaryEntry
FDDictionaryEntryCommand & getDictionaryEntry()
The dictionary entry associated with the command.
Definition: efd.h:1181
DiameterDataType
DiameterDataType
The Diameter AVP data types.
Definition: efd.h:369
FDDictionaryEntryAVP::getVendorId
vendor_id_t getVendorId() const
Returns the AVP vendor ID.
Definition: efd.h:435
FDExtractorAvp::get
Bool get(uint64_t &v)
Retrieves an uint64_t AVP value. Returns True if the value is successfully retrieved.
Definition: efd.h:1705
eutil.h
Defines various utility functions.
FDExtractorBase::getDictionaryEntry
FDDictionaryEntryAVP * getDictionaryEntry()
Retrieves the dictionary entry associated with the AVP.
Definition: efd.h:1472
FDApplication::~FDApplication
~FDApplication()
Class destructor.
Definition: efd.cpp:1501
FDAvp::addJson
FDAvp & addJson(const char *json)
Adds the AVP's represented in a JSON string.
Definition: efd.cpp:1087
FDPeer::isOpen
Bool isOpen()
Indicates if the connection to the peer is open.
Definition: efd.h:1376
FDMessage::add
FDMessage & add(FDAvp &avp)
Adds the contents of "avp" to this message.
Definition: efd.h:853
FDExtractorKey
Used as the key to a collection of extractors.
Definition: efd.h:1481
FDSession::~FDSession
~FDSession()
Class destructor.
Definition: efd.cpp:1601
FDCommandRequest::FDCommandRequest
FDCommandRequest(FDDictionaryEntryCommand &de)
Class constructor.
Definition: efd.cpp:1488
eFDExtractorType
eFDExtractorType
Defines the types of extractors.
Definition: efd.h:1416
PSNew
The peer has been just been created, PSM thread not started yet.
Definition: efd.h:1293
DDTUnknown
unknown/undefined
Definition: efd.h:372
FDUtility::str2tbcd
static size_t str2tbcd(const char *src, size_t srclen, uint8_t *dst, size_t dstlen)
Converts a series of digits to telephony binary coded decimal.
Definition: efd.cpp:2253
FDMessage::getCommand
FDDictionaryEntryCommand * getCommand()
Definition: efd.h:847
FDApplication::setDictionaryEntry
FDDictionaryEntryApplication * setDictionaryEntry(FDDictionaryEntryApplication *de)
Retrieves the dictionary entry for the application.
Definition: efd.h:1247
FDExtractorList::exists
Bool exists()
Determines if this extractor exists in the underlying freeDiameter message or grouped AVP.
Definition: efd.cpp:2095
FDMessageRequest
Represents a Diameter request message.
Definition: efd.h:1129
FDDictionaryEntryApplication
A dictionary entry object associated with an application.
Definition: efd.h:308
FDMessage::addOrigin
Void addOrigin()
Adds the Origin-Host and Origin-Realm to this message.
Definition: efd.cpp:1303
FDExtractorAvp::get
Bool get(int32_t &v)
Retrieves an int32_t AVP value. Returns True if the value is successfully retrieved.
Definition: efd.h:1697
FDAvp::setAvp
FDAvp & setAvp(struct avp *a)
Sets the freeDiameter AVP object that this object is associated with.
Definition: efd.cpp:1023
FDSession
Allocates and assigns a Session-Id.
Definition: efd.h:1261
FDAvp::set
FDAvp & set(const uint8_t *v, size_t len)
Assigns an octet string value to this AVP.
Definition: efd.h:735
FDExtractorAvp::get
Bool get(sSS &ss)
Retrieves an IP address AVP value.
Definition: efd.h:1735
FDMessage::addJson
FDMessage & addJson(const std::string &json)
Adds the AVP's represented in the JSON string.
Definition: efd.h:1045
FDCommandRequest::process
virtual Int process(FDMessageRequest *req)=0
Method that will process the request.
FDPeerList
A list of FDPeer objects.
Definition: efd.h:1393
FDEngine::start
Bool start()
Starts freeDiameter.
Definition: efd.cpp:169
FDExtractorList::createExtractor
virtual FDExtractor * createExtractor()=0
Virtual method to create an extractor list member object.
FDMessageRequest::setPreserveAnswer
Bool setPreserveAnswer(Bool preserve)
Sets indication whether to preserve the answer or not.
Definition: efd.h:1161
FDEngine::FDEngine
FDEngine(const char *cfgfile=NULL)
Class constructor.
Definition: efd.cpp:129
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, const char *v)
Adds a string value to this message.
Definition: efd.h:895
FDExtractorAvp::get
Bool get(float &v)
Retrieves a float AVP value.
Definition: efd.h:1709
FDExtractor::getReference
msg_or_avp * getReference()
retrieves the freeDiameter reference for this extractor.
Definition: efd.cpp:1902
FDExtractor::setReference
Void setReference(FDMessage &msg)
Assigns the reference that this extractor is associated wtih.
Definition: efd.h:1573
FDSession::FDSession
FDSession()
Class constructor.
Definition: efd.cpp:1576
FDExtractorKey::FDExtractorKey
FDExtractorKey(vendor_id_t v, avp_code_t a)
Class constructor.
Definition: efd.h:1494
FDMessage::isRequest
Bool isRequest()
Indicates if this message is a request.
Definition: efd.h:1023
FDAvp::get
Bool get(uint32_t &v)
Retrieves an uint32_t AVP value. Returns True if the value is successfully retrieved.
Definition: efd.h:659
PSWaitCnxAck
Attempting to establish transport-level connection.
Definition: efd.h:1301
FDMessageRequest::~FDMessageRequest
virtual ~FDMessageRequest()
Definition: efd.cpp:1436
FDAvp::set
FDAvp & set(double v)
Assigns a double value to this AVP.
Definition: efd.h:724
FDApplication::getDictionaryEntry
FDDictionaryEntryApplication & getDictionaryEntry()
The dictionary entry for the application.
Definition: efd.h:1235
FDMessageRequest::getPreserveAnswer
Bool getPreserveAnswer()
Sets indication whether to preserve the answer or not.
Definition: efd.h:1164
FDAvp::set
FDAvp & set(const std::string &v)
Assigns a string value to this AVP.
Definition: efd.h:740
FDExtractorBase::FDExtractorBase
FDExtractorBase(FDDictionaryEntryAVP *de)
Class constructor.
Definition: efd.h:1434
FDExtractorAvpList::getList
std::list< FDExtractorAvp * > & getList()
Retrieves the list of extractors.
Definition: efd.cpp:2169
FDDictionaryEntryCommand::getCommandCode
command_code_t getCommandCode()
Returns the command ID.
Definition: efd.h:488
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, char *v, size_t &len)
Retrieves the octet string AVP value associated with specified dictionary entry.
Definition: efd.h:992
FDEngine::uninit
Void uninit(Bool wait=true)
Shuts down freeDiameter.
Definition: efd.cpp:185
FDEngine::init
Bool init()
Initializes freeDiameter and loads the configuration file.
Definition: efd.cpp:144
FDExtractor
A wrapper around a grouped AVP used to locate and access the AVP's in the parent message or grouped A...
Definition: efd.h:1545
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, int32_t &v)
Retrieves the int32_t AVP value associated with specified dictionary entry.
Definition: efd.h:949
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, const uint8_t *v, size_t len)
Adds an octet string value to this message.
Definition: efd.h:915
DDTI64
64-bit integer
Definition: efd.h:378
FDExtractorList::getParent
FDExtractor & getParent()
Retrieves the parent extractor object.
Definition: efd.h:1635
FDPeer::getDiameterId
const std::string & getDiameterId()
Retrieves the Diameter ID of the peer.
Definition: efd.h:1337
FDPeer::getState
FDPeerState getState()
Retrieves the peer connection state.
Definition: efd.cpp:1684
FDMessageRequest::send
FDMessageRequest & send()
Sends the request.
Definition: efd.cpp:1440
FDEngine::~FDEngine
~FDEngine()
Class destructor.
Definition: efd.cpp:140
DDTDiameterIdentity
diameter identity (UTF-8 string)
Definition: efd.h:396
FDPeer::setDestinationIp
const EString & setDestinationIp(const std::string &ip)
Assigns the peer's IP address.
Definition: efd.h:1365
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, const ETime &v)
Adds a time AVP to this grouped AVP.
Definition: efd.h:604
FDHook::getHookMask
UInt getHookMask()
Retrieves the hook mask.
Definition: efd.h:1818
EString
String class.
Definition: estring.h:30
FDEngine::setConfigFile
const EString & setConfigFile(const std::string &cf)
Sets the configuration file.
Definition: efd.h:237
FDAvp::operator=
FDAvp & operator=(int64_t v)
Assigns an int64_t value to this AVP.
Definition: efd.h:615
FDPeer::FDPeer
FDPeer()
Class constructor.
Definition: efd.cpp:1663
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, uint64_t &v)
Retrieves the uint64_t AVP value associated with specified dictionary entry.
Definition: efd.h:967
FDAvp::getAvp
struct avp * getAvp()
Returns the underlying freeDiameter AVP object.
Definition: efd.h:770
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, int64_t v)
Adds an int64_t value to this message.
Definition: efd.h:865
FDExtractor::resolve
Void resolve()
Locates this AVP in the freeDiameter message or grouped AVP.
Definition: efd.cpp:1910
FDApplication
Represents a Diameter application.
Definition: efd.h:1224
PSSuspect
A DWR was sent and not answered within TwTime. Failover in progress.
Definition: efd.h:1309
FDMessage::get
Bool get(FDDictionaryEntryAVP &de, uint32_t &v)
Retrieves the uint32_t AVP value associated with specified dictionary entry.
Definition: efd.h:961
FDEngine
Provides an interface for controlling freeDiameter.
Definition: efd.h:198
FDExtractorAvp::get
Bool get(ETime &t)
Retrieves a time AVP value.
Definition: efd.h:1740
PSOpenNew
After CEA is sent, until a new message is received. Force ordering in this state.
Definition: efd.h:1313
FDMessageAnswer::send
FDMessageAnswer & send()
Sends the answer.
Definition: efd.cpp:1397
FDPeer::getDestinationRealm
const EString & getDestinationRealm() const
Retrieves the distination realm for this peer.
Definition: efd.h:1356
DDTAddress
IP address.
Definition: efd.h:390
FDMessage::getFirstAVP
FDAvp getFirstAVP(Bool &found)
Retrieves the first AVP object from this message.
Definition: efd.cpp:1230
DDTEnumerated
enumerated type
Definition: efd.h:400
FDPeer::setDestinationIp
const EString & setDestinationIp(const char *ip)
Assigns the peer's IP address.
Definition: efd.h:1361
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, double v)
Adds a double value to this message.
Definition: efd.h:889
FDExtractorAvp::get
Bool get(char *data, size_t &len)
Retrieves an octet string AVP value.
Definition: efd.h:1726
FDDictionaryEntry::FDDictionaryEntry
FDDictionaryEntry()
Class constructor.
Definition: efd.cpp:232
FDMessage
Represents a freeDiameter message.
Definition: efd.h:844
FDExtractorBase::exists
Bool exists()
Retrieves status indicating if the AVP is present/exists in the message.
Definition: efd.h:1468
FDMessageRequest::processAnswer
virtual Void processAnswer(FDMessageAnswer &ans)
A virtual message that will process the answer message received in response to this request message.
Definition: efd.cpp:1447
FDExtractorBase
Extractor base class. An extractor is a wrapper around an AVP that locates and accesses the AVP in th...
Definition: efd.h:1429
FDDictionaryEntry
A class wrapper around a freeDiameter dictionary entry. This base class is not intended to be directl...
Definition: efd.h:261
FDExtractor::getParent
FDExtractor * getParent()
retrieves the parent of this extractor.
Definition: efd.h:1583
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, float v)
Adds a float value to this message.
Definition: efd.h:883
FDPeer::add
Void add()
Adds the peer to freeDiameter.
Definition: efd.cpp:1720
FDPeer::getDestinationHost
const EString & getDestinationHost() const
Retrieves the distination host for this peer.
Definition: efd.h:1353
FDHook::getHandle
struct fd_hook_hdl * getHandle()
Retrieves the hook handle.
Definition: efd.h:1814
FDPeerList::~FDPeerList
~FDPeerList()
Class destructor.
Definition: efd.cpp:1821
FDExtractorAvp
An AVP extractor object.
Definition: efd.h:1665
FDExtractorAvp::setAvp
Void setAvp(struct avp *a)
Assigns the underlying freeDiameter AVP to this extractor.
Definition: efd.h:1682
etExtractorList
represents an extractor list (grouped AVP)
Definition: efd.h:1425
FDAvp::getNext
FDAvp getNext(Bool &found)
Returns the next AVP from a grouped AVP.
Definition: efd.cpp:921
estring.h
Encapsulates and extends a std::string object.
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, const std::string &v)
Adds a string value to this message.
Definition: efd.h:901
FDAvp::get
Bool get(float &v)
Retrieves a float AVP value.
Definition: efd.h:667
FDMessage::add
FDMessage & add(FDDictionaryEntryAVP &de, const char *v, size_t len)
Adds an octet string value to this message.
Definition: efd.h:908
FDDictionaryEntryAVP::getDataType
DiameterDataType getDataType() const
Returns the data type of the AVP.
Definition: efd.h:441
FDAvp::operator=
FDAvp & operator=(float v)
Assigns a float value to this AVP.
Definition: efd.h:630
DDTIPFilterRule
IP filter rule.
Definition: efd.h:402
FDAvp::operator=
FDAvp & operator=(const ETime &v)
Assigns a time value to this AVP.
Definition: efd.h:650
FDExtractor::getJson
Bool getJson(std::string &json)
Retrieves a JSON representation of the message or AVP.
Definition: efd.cpp:2060
FDAvp::operator=
FDAvp & operator=(const char *v)
Assigns a string value to this AVP.
Definition: efd.h:640
FDDictionaryEntryApplication::getId
application_id_t getId() const
Returns the Diameter application ID of the application.
Definition: efd.h:323
FDPeerList::isPeerOpen
Bool isPeerOpen()
Indicates if the peer is in an open state.
Definition: efd.cpp:1831
FDAvp::operator=
FDAvp & operator=(int32_t v)
Assigns an int32_t value to this AVP.
Definition: efd.h:610
FDDictionaryEntryVendor::getName
const char * getName()
Returns the name of the vendor.
Definition: efd.h:355
FDExtractor::setReference
Void setReference(msg_or_avp *m)
Assigns the reference that this extractor is associated wtih.
Definition: efd.h:1579
FDExtractorBase::getExtractorType
virtual eFDExtractorType getExtractorType()=0
Retrieves the type of this extractor.
FDExtractorAvpList::dump
Void dump()
Prints the underlying freeDiameter message or AVP to stdout.
Definition: efd.cpp:2177
FDExtractorBase::getIndex
Int getIndex()
Retrieves the location of the AVP in the parent (message or AVP).
Definition: efd.h:1452
FDExtractorAvp::dump
Void dump()
Prints the contents of this AVP to the screen.
Definition: efd.cpp:2129
FDDictionaryEntryAVP::isDerived
Bool isDerived() const
Indicates whether the data type is derived from another or if it is a base data type.
Definition: efd.h:428
FDExtractorAvp::~FDExtractorAvp
virtual ~FDExtractorAvp()
Class destructor.
Definition: efd.cpp:2117
FDDictionaryEntryCommand::isRequest
Bool isRequest() const
Returns True of the command is a request.
Definition: efd.h:481
FDAvp::add
FDAvp & add(FDDictionaryEntryAVP &de, const char *v, size_t len)
Adds an octet string AVP to this grouped AVP.
Definition: efd.h:591
FDCommandRequest
Represents a command request.
Definition: efd.h:1202
DDTF64
64-bit floating point
Definition: efd.h:386
FDAvp::dump
Void dump()
Prints the contents of this AVP to the screen.
Definition: efd.cpp:1100
FDSession::getSessionId
const EString & getSessionId()
Retrieves a string representation of the session ID.
Definition: efd.cpp:1628