提交 6b2aa9e5 编写于 作者: C calincerchez

work commit

上级 95e34a80
......@@ -46,11 +46,11 @@ void DiameterBase::initialize(int stage) {
void DiameterBase::handleMessage(cMessage *msg) {
if (msg->isSelfMessage()) {
if (msg->isSelfMessage()) { // handles timers
DiameterPeer *peer = (DiameterPeer*)msg->getContextPointer();
peer->processTimer(msg);
} else {
DiameterConnection *conn = connMap.findConnectionFor(msg);
} else { // handles SCTP messages
DiameterConnection *conn = conns.findConnectionFor(msg);
if (!conn) {
// new connection -- create new socket object and server process
SCTPSocket *socket = new SCTPSocket(msg);
......@@ -58,7 +58,7 @@ void DiameterBase::handleMessage(cMessage *msg) {
conn = new DiameterConnection(this);
conn->setType(RESPONDER);
conn->setSocket(socket);
connMap.addConnection(conn);
conns.addConnection(conn);
socket->setCallbackObject(conn);
socket->setOutboundStreams(outboundStreams);
......@@ -197,7 +197,7 @@ DiameterConnection *DiameterBase::createConnection(AddressVector addresses, int
conn->setAddresses(addresses);
conn->setPort(port);
conn->setType(INITIATOR);
connMap.addConnection(conn);
conns.addConnection(conn);
return conn;
}
......
......@@ -22,98 +22,117 @@
#include <string>
#include "SCTPSocket.h"
#include "DiameterConnectionMap.h"
#include "DiameterSessionTable.h"
#include "DiameterSession.h"
#include "DiameterPeerTable.h"
#include "RoutingTableAccess.h"
/*
* Implements the SCTP protocol. This section describes the internal
* architecture of the SCTP model.
* Implements the Diameter base protocol. This section describes the internal
* architecture of the Diameter model.
*
* You may want to check the SCTPSocket
* class which makes it easier to use SCTP from applications.
*
* The SCTP protocol implementation is composed of several classes (discussion
* The Diameter base protocol implementation is composed of several classes (discussion
* follows below):
* - SCTP: the module class
* - SCTPAssociation: manages a connection
* - SCTPSendQueue, SCTPReceiveQueue: abstract base classes for various types
* of send and receive queues
* - SCTPAlgorithm: abstract base class for SCTP algorithms
*
* SCTP subclassed from cSimpleModule. It manages socketpair-to-connection
* mapping, and dispatches segments and user commands to the appropriate
* SCTPAssociation object.
*
* SCTPAssociation manages the connection, with the help of other objects.
* SCTPAssociation itself implements the basic SCTP "machinery": takes care
* of the state machine, stores the state variables (TCB), sends/receives
* etc.
*
* SCTPAssociation internally relies on 3 objects. The first two are subclassed
* from SCTPSendQueue and SCTPReceiveQueue. They manage the actual data stream,
* so SCTPAssociation itself only works with sequence number variables.
* This makes it possible to easily accomodate need for various types of
* simulated data transfer: real byte stream, "virtual" bytes (byte counts
* only), and sequence of cMessage objects (where every message object is
* mapped to a SCTP sequence number range).
*
* Currently implemented send queue and receive queue classes are
* SCTPVirtualDataSendQueue and SCTPVirtualDataRcvQueue which implement
* queues with "virtual" bytes (byte counts only).
* - DiameterBase: the module class
* - DiameterConnection: manages a connection between two peers
* - DiameterPeer: manages a Diameter peer
* - DiameterSession: manages a session between end to end peers
* - DiameterApplication: manages a Diameter application
*
* The third object is subclassed from SCTPAlgorithm. Control over
* retransmissions, congestion control and ACK sending are "outsourced"
* from SCTPAssociation into SCTPAlgorithm: delayed acks, slow start, fast rexmit,
* etc. are all implemented in SCTPAlgorithm subclasses.
* Diameter base class holds the server socket from which each Diameter connection is forked.
* Also it manages the connection table, peer table and session table.
*
* The concrete SCTPAlgorithm class to use can be chosen per connection (in OPEN)
* or in a module parameter.
* All Diameter base protocol model is implemented according to RFC 3588.
*/
class DiameterBase : public cSimpleModule {
public:
std::string fqdn;
std::string realm;
unsigned vendorId;
std::string productName;
unsigned sessionIds;
protected:
std::string fqdn;
std::string realm;
unsigned vendorId;
std::string productName;
unsigned sessionIds;
int outboundStreams;
SCTPSocket serverSocket;
DiameterConnectionMap connMap;
DiameterConnectionMap conns;
DiameterSessionTable sessions;
DiameterPeerTable peers;
IRoutingTable *rT;
/*
* Methods for loading the configuration from the XML file
* ex.
* <DNS>
* <Entry fqdn="mme.lte.test" address="192.168.3.2"/>
* </DNS>
* <Diameter
* fqdn="hss.lte.test"
* realm="lte.test"
* vendor="0"
* product="HSSDiameter">
* <Listeners port="3868">
* <Listener address="192.168.3.1"/>
* </Listeners>
* <Peers>
* </Peers>
* </Diameter>
*/
void loadOwnConfigFromXML(const cXMLElement & diameterNode);
void loadPeersFromXML(const cXMLElement & diameterNode);
void loadListenersFromXML(const cXMLElement & diameterNode);
void loadConfigFromXML(const char *filename);
AddressVector queryDNS(const cXMLElement& diameterNode, const std::string fqdnIn, int port);
AddressVector findLocalAddresses(AddressVector remoteAddrs);
public:
DiameterBase();
virtual ~DiameterBase();
virtual int numInitStages() const { return 5; }
/*
* Method for reading and processing the configuration file. This includes
* loading the Diameter peers, creating for each a initiating or responding
* Diameter connection and loading the Diameter application.
*/
void initialize(int stage);
/*
* Method for handling incoming messages. If the message is a timer, it sends it
* to the appropriate peer. If the message is a SCTP message, it finds the
* appropriate socket and sends the message to it. If no socket is available,
* it creates a new socket together with a new Diameter connection.
*/
void handleMessage(cMessage *msg);
/*
*
* Method for processing application messages. This method should be overridden
* by Diameter application implementations.
*/
virtual DiameterMessage *processMessage(DiameterMessage *msg) { return NULL; }
/*
* Getter methods.
*/
int getOutboundStreams() { return outboundStreams; }
SCTPSocket getServerSocket() { return serverSocket; }
std::string getFqdn() { return fqdn; }
std::string getRealm() { return realm; }
unsigned getVendorId() { return vendorId; }
std::string getProductName() { return productName; }
/*
* Utility methods.
*/
DiameterConnection *createConnection(AddressVector addresses, int port);
DiameterPeer *createPeer(std::string dFQDN, std::string dRealm, DiameterConnection *conn, DiameterApplication *appl = NULL);
DiameterConnection *removeConnection(DiameterConnection *conn) { return connMap.removeConnection(conn); }
DiameterPeer *findPeer(std::string dFQDN, std::string dRealm = "") { return peers.findPeer(dFQDN, dRealm); }
DiameterPeer *findPeer(unsigned applId) { return peers.findPeer(applId); }
DiameterConnection *removeConnection(DiameterConnection *conn) { return conns.removeConnection(conn); }
DiameterSession *createSession(bool stType);
unsigned genSessionId() { return ++sessionIds; }
/*
* Wrapper methods.
*/
DiameterPeer *findPeer(std::string dFQDN, std::string dRealm = "") { return peers.findPeer(dFQDN, dRealm); }
DiameterPeer *findPeer(unsigned applId) { return peers.findPeer(applId); }
};
#endif /* DIAMETERBASE_H_ */
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#include "DiameterClient.h"
Define_Module(DiameterClient);
DiameterClient::DiameterClient() {
// TODO Auto-generated constructor stub
}
DiameterClient::~DiameterClient() {
// TODO Auto-generated destructor stub
}
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#ifndef DIAMETERCLIENT_H_
#define DIAMETERCLIENT_H_
#include "DiameterBase.h"
class DiameterClient : public DiameterBase {
public:
DiameterClient();
virtual ~DiameterClient();
void initialize(int stage) { DiameterBase::initialize(stage); }
void handleMessage(cMessage *msg) { DiameterBase::handleMessage(msg); }
};
#endif /* DIAMETERCLIENT_H_ */
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
package inet.applications.diameter;
simple DiameterClient like DiameterBase {
parameters:
@display("i=block/app");
string configFile;
gates:
input sctpIn;
output sctpOut;
}
\ No newline at end of file
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#include "DiameterServer.h"
Define_Module(DiameterServer)
DiameterServer::DiameterServer() {
// TODO Auto-generated constructor stub
}
DiameterServer::~DiameterServer() {
// TODO Auto-generated destructor stub
}
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#ifndef DIAMETERSERVER_H_
#define DIAMETERSERVER_H_
#include "DiameterBase.h"
class DiameterServer : public DiameterBase {
public:
DiameterServer();
virtual ~DiameterServer();
void initialize(int stage) { DiameterBase::initialize(stage); }
void handleMessage(cMessage *msg) { DiameterBase::handleMessage(msg); }
};
#endif /* DIAMETERSERVER_H_ */
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
package inet.applications.diameter;
simple DiameterServer like DiameterBase {
parameters:
@display("i=block/app");
string configFile;
gates:
input sctpIn;
output sctpOut;
}
\ No newline at end of file
......@@ -27,8 +27,8 @@ DiameterSession::DiameterSession(DiameterBase *module, bool state) {
char time[10];
sprintf(time, "%d", (unsigned)simTime().raw());
char id[10];
sprintf(id, "%d", module->sessionIds++);
this->id = module->fqdn + ";" + time + ";" + id;
sprintf(id, "%d", module->genSessionId());
this->id = module->getFqdn() + ";" + time + ";" + id;
fsm = new cFSM();
fsm->setName("sessionState");
......@@ -119,3 +119,30 @@ const char *DiameterSession::eventName(int event) {
return s;
#undef CASE
}
DiameterSessionTable::DiameterSessionTable() {
// TODO Auto-generated constructor stub
}
DiameterSessionTable::~DiameterSessionTable() {
// TODO Auto-generated destructor stub
}
DiameterSession *DiameterSessionTable::find(std::string id) {
for (unsigned i = 0; i < sessions.size(); i++) {
if (sessions.at(i)->getId() == id)
return sessions.at(i);
}
return NULL;
}
void DiameterSessionTable::erase(unsigned start, unsigned end) {
SessionTable::iterator first = sessions.begin() + start;
SessionTable::iterator last = sessions.begin() + end;
SessionTable::iterator i = first;
for (;i != last; ++i)
delete *i;
sessions.erase(first, last);
}
......@@ -41,9 +41,14 @@ enum SessionEvent {
RequestReceived,
};
/*
* Class Diameter session. The class implements the session state machine
* and processes Diameter application messages which are not meant for
* Diameter base protocol.
*/
class DiameterSession : public cPolymorphic {
private:
bool state;
bool type; // stateful or stateless
std::string id;
cFSM *fsm;
// cMessage *sTimer;
......@@ -62,4 +67,20 @@ public:
void performStateTransition(SessionEvent &event, unsigned applId, DiameterPeer *peer, DiameterMessage *msg);
};
class DiameterSessionTable {
private:
typedef std::vector<DiameterSession*> SessionTable;
SessionTable sessions;
public:
DiameterSessionTable();
virtual ~DiameterSessionTable();
DiameterSession *find(std::string id);
DiameterSession *at(unsigned i) { return sessions.at(i); }
void push_back(DiameterSession *session) { sessions.push_back(session); }
void erase(unsigned start, unsigned end);
unsigned size() {return sessions.size();}
// void deleteSessions();
};
#endif /* DIAMETERSESSION_H_ */
......@@ -29,8 +29,8 @@ DiameterPeer::DiameterPeer(DiameterBase *module) {
this->module = module;
this->dFQDN = "";
this->dFQDN = "";
this->oFQDN = module->fqdn;
this->oRealm = module->realm;
this->oFQDN = module->getFqdn();
this->oRealm = module->getRealm();
char fsmname[24];
sprintf(fsmname, "fsm-%s", oFQDN.data());
......@@ -464,8 +464,8 @@ void DiameterPeer::sendCER(DiameterConnection *conn) {
cer->setHdr(DiameterUtils().createHeader(CapabilitiesExchange, 1, 0, 0, 0, appl->applId, uniform(0, 10000), uniform(0, 10000)));
cer->pushAvp(DiameterUtils().createAddressAVP(AVP_HostIPAddress, 0, 1, 0, 0, module->getServerSocket().getLocalAddresses().at(0)));
cer->pushAvp(DiameterUtils().createUnsigned32AVP(AVP_VendorId, 0, 1, 0, 0, module->vendorId));
cer->pushAvp(DiameterUtils().createUTF8StringAVP(AVP_ProductName, 0, 1, 0, 0, module->productName));
cer->pushAvp(DiameterUtils().createUnsigned32AVP(AVP_VendorId, 0, 1, 0, 0, module->getVendorId()));
cer->pushAvp(DiameterUtils().createUTF8StringAVP(AVP_ProductName, 0, 1, 0, 0, module->getProductName()));
if (appl) {
AVP *authApplId = DiameterUtils().createUnsigned32AVP(AVP_AuthApplId, 0, 1, 0, 0, appl->applId);
......@@ -486,8 +486,8 @@ void DiameterPeer::sendCEA(DiameterConnection *conn, DiameterMessage *cer, unsig
cea->pushAvp(DiameterUtils().createUnsigned32AVP(AVP_ResultCode, 0, 1, 0, 0, resCode));
cea->pushAvp(DiameterUtils().createAddressAVP(AVP_HostIPAddress, 0, 1, 0, 0, module->getServerSocket().getLocalAddresses().at(0)));
cea->pushAvp(DiameterUtils().createUnsigned32AVP(AVP_VendorId, 0, 1, 0, 0, module->vendorId));
cea->pushAvp(DiameterUtils().createUTF8StringAVP(AVP_ProductName, 0, 1, 0, 0, module->productName));
cea->pushAvp(DiameterUtils().createUnsigned32AVP(AVP_VendorId, 0, 1, 0, 0, module->getVendorId()));
cea->pushAvp(DiameterUtils().createUTF8StringAVP(AVP_ProductName, 0, 1, 0, 0, module->getProductName()));
if (appl) {
std::vector<AVP*> avps;
......
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#include "DiameterSessionTable.h"
#include <algorithm>
DiameterSessionTable::DiameterSessionTable() {
// TODO Auto-generated constructor stub
}
DiameterSessionTable::~DiameterSessionTable() {
// TODO Auto-generated destructor stub
}
DiameterSession *DiameterSessionTable::find(std::string id) {
for (unsigned i = 0; i < sessions.size(); i++) {
if (sessions.at(i)->getId() == id)
return sessions.at(i);
}
return NULL;
}
void DiameterSessionTable::erase(unsigned start, unsigned end) {
SessionTable::iterator first = sessions.begin() + start;
SessionTable::iterator last = sessions.begin() + end;
SessionTable::iterator i = first;
for (;i != last; ++i)
delete *i;
sessions.erase(first, last);
}
//
// Copyright (C) 2012 Calin Cerchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#ifndef DIAMETERSESSIONTABLE_H_
#define DIAMETERSESSIONTABLE_H_
#include "DiameterSession.h"
class DiameterSessionTable {
private:
typedef std::vector<DiameterSession*> SessionTable;
SessionTable sessions;
public:
DiameterSessionTable();
virtual ~DiameterSessionTable();
DiameterSession *find(std::string id);
DiameterSession *at(unsigned i) { return sessions.at(i); }
void push_back(DiameterSession *session) { sessions.push_back(session); }
void erase(unsigned start, unsigned end);
unsigned size() {return sessions.size();}
// void deleteSessions();
};
#endif /* DIAMETERSESSIONTABLE_H_ */
......@@ -21,6 +21,10 @@
#include "INETDefs.h"
#include "DiameterMessage_m.h"
/*
* Class for Diameter message. This class inherits the message
* base class from .msg file and adds the vector with the AVPs.
*/
class DiameterMessage : public DiameterMessage_Base {
protected:
typedef std::vector<AVPPtr> AVPVector;
......@@ -29,17 +33,42 @@ public:
DiameterMessage(const char *name=NULL, int kind=0) : DiameterMessage_Base(name,kind) {}
DiameterMessage(const DiameterMessage& other) : DiameterMessage_Base(other.getName()) {operator=(other);}
virtual ~DiameterMessage();
DiameterMessage& operator=(const DiameterMessage& other);
virtual DiameterMessage *dup() const {return new DiameterMessage(*this);}
/*
* Methods overridden but not used. You should use instead pushAvp or insertAvp.
*/
virtual void setAvpsArraySize(unsigned int size);
virtual void setAvps(unsigned int k, const AVPPtr& avps_var);
/*
* Getter methods.
*/
virtual unsigned int getAvpsArraySize() const;
virtual AVPPtr& getAvps(unsigned int k);
/*
* Method for pushing AVP at the end of the vector.
*/
void pushAvp(AVPPtr avp) { avps.push_back(avp); }
/*
* Method for inserting AVP at a given position in the vector.
*/
void insertAvp(unsigned pos, AVPPtr avp);
/*
* Method for printing the message contents. Currently it prints info
* only for the header.
*/
void print();
/*
* Method for finding a AVP with a given AVP code within the vector.
* It returns NULL if the AVP is not found.
*/
AVPPtr findAvp(unsigned avpCode);
};
......
......@@ -21,17 +21,40 @@
#include "DiameterMessage.h"
#include "SCTPMessage_m.h"
/*
* Class for serializing and parsing of Diameter messages.
* This class will be used to serialize a Diameter message before sending it
* to SCTP layer and parsing the message when it comes from SCTP layer.
*/
class DiameterSerializer {
private:
/*
* Method returns the length of the Diameter message. The length includes
* the header, all the AVPs (header + payload) and offset bytes, if it is
* needed.
*/
unsigned getMessageLength(DiameterMessage *msg);
/*
* Methods for serializing and parsing of Diameter header.
*/
unsigned serializeHeader(DiameterHeader hdr, unsigned len, char *p);
unsigned parseHeader(DiameterHeader *hdr, char *p);
public:
DiameterSerializer();
virtual ~DiameterSerializer();
/*
* Methods for serializing and parsing of Diameter AVP.
*/
unsigned serializeAVP(AVP *avp, char *p);
unsigned parseAVP(AVP *avp, char *p);
/*
* Methods for serializing and parsing of Diameter Message. Serialize method
* will generate directly a SCTP message with the resulted bytes and parse
* method will process a SCTP message and generate the appropriate Diameter message.
*/
SCTPSimpleMessage *serialize(DiameterMessage *msg);
DiameterMessage *parse(const SCTPSimpleMessage *msg);
};
......
......@@ -22,25 +22,31 @@
#include "DiameterMessage_m.h"
#define IPV4_ADDRESS_TYPE 1
#define IPV4_ADDRESS_SIZE 4
/*
* Diameter utility class. It is used for creating and processing Diameter header and AVPs.
*/
class DiameterUtils {
private:
AVP *createBaseAVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId);
public:
DiameterUtils();
virtual ~DiameterUtils();
/*
* Methods for Diameter header and AVP creation.
*/
DiameterHeader createHeader(unsigned commandCode, bool reqFlag, bool prxyFlag, bool errFlag, bool retrFlag, unsigned applId, unsigned hopByHopId, unsigned endToEndId);
AVP *createBaseAVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId);
AVP *createOctetStringAVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId, unsigned len, const char *str);
AVP *createUTF8StringAVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId, std::string str);
AVP *createAddressAVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId, IPvXAddress addr);
AVP *createUnsigned32AVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId, unsigned val);
AVP *createInteger32AVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId, int val);
AVP *createGroupedAVP(unsigned avpCode, bool vendFlag, bool manFlag, bool privFlag, unsigned vendorId, std::vector<AVP*> avps);
DiameterHeader createHeader(unsigned commandCode, bool reqFlag, bool prxyFlag, bool errFlag, bool retrFlag, unsigned applId, unsigned hopByHopId, unsigned endToEndId);
/*
* Methods for Diameter header and AVP processing.
*/
unsigned processUnsigned32AVP(AVP *unsigned32AVP);
int processInteger32AVP(AVP *integer32AVP);
char *processOctetStringAVP(AVP *octetStringAVP);
......@@ -48,10 +54,20 @@ public:
IPvXAddress processAddressAVP(AVP *addressAVP);
std::vector<AVP*> processGroupedAVP(AVP *groupedAVP);
/*
* Methods for finding AVP or arrays of AVPs in grouped AVPs.
*/
AVP *findAVP(unsigned avpCode, std::vector<AVP*>avps);
std::vector<AVP*> findAVPs(unsigned avpCode, std::vector<AVP*>avps);
/*
* Method for printing the name of a AVP code.
*/
const char *avpName(unsigned avpCode);
/*
* Method for cleaning grouped AVPs.
*/
void deleteGroupedAVP(std::vector<AVP*>avps);
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册