r2914 - in trunk/libmsip: include/libmsip source source/dialogs
source/headers source/transactions
erik at minisip.org
erik at minisip.org
Fri Nov 17 17:29:14 CET 2006
Author: erik
Date: 2006-11-17 17:29:13 +0100 (Fri, 17 Nov 2006)
New Revision: 2914
Modified:
trunk/libmsip/include/libmsip/SipAuthenticationDigest.h
trunk/libmsip/include/libmsip/SipDialog.h
trunk/libmsip/include/libmsip/SipDialogConfig.h
trunk/libmsip/include/libmsip/SipDialogRegister.h
trunk/libmsip/include/libmsip/SipDialogUtils.h
trunk/libmsip/include/libmsip/SipHeader.h
trunk/libmsip/include/libmsip/SipLayerDialog.h
trunk/libmsip/include/libmsip/SipLayerTransport.h
trunk/libmsip/include/libmsip/SipStackInternal.h
trunk/libmsip/include/libmsip/SipTransaction.h
trunk/libmsip/include/libmsip/SipUri.h
trunk/libmsip/source/SipAuthenticationDigest.cxx
trunk/libmsip/source/SipDialogConfig.cxx
trunk/libmsip/source/SipLayerDialog.cxx
trunk/libmsip/source/SipLayerTransport.cxx
trunk/libmsip/source/SipStackInternal.cxx
trunk/libmsip/source/SipUri.cxx
trunk/libmsip/source/dialogs/SipDialog.cxx
trunk/libmsip/source/dialogs/SipDialogRegister.cxx
trunk/libmsip/source/headers/SipHeader.cxx
trunk/libmsip/source/transactions/SipTransaction.cxx
Log:
libmsip: move code from .h -> .cxx
Modified: trunk/libmsip/include/libmsip/SipAuthenticationDigest.h
===================================================================
--- trunk/libmsip/include/libmsip/SipAuthenticationDigest.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipAuthenticationDigest.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -50,8 +50,8 @@
*/
MRef<SipHeaderValueAuthorization*> createAuthorization( MRef<SipRequest*> req) const;
- const std::string &getRealm() const{ return realm; }
- bool getStale() const{ return stale; }
+ const std::string &getRealm() const;
+ bool getStale() const;
/**
* @return SIP_HEADER_TYPE_WWWAUTHENTICATE or
Modified: trunk/libmsip/include/libmsip/SipDialog.h
===================================================================
--- trunk/libmsip/include/libmsip/SipDialog.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipDialog.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -157,7 +157,7 @@
* get the Call-Id of the dialog
* @return string containing the Call-Id
*/
- std::string getCallId(){return dialogState.callId;}
+ std::string getCallId();
MRef<SipStack*> getSipStack();
@@ -172,7 +172,7 @@
*/
// void registerTransactionToDialog(MRef<SipTransaction*> trans);
- std::list<std::string> getRouteSet(){return dialogState.routeSet;}
+ std::list<std::string> getRouteSet();
/**
* Add the dialog route set if the dialog is established,
@@ -185,7 +185,7 @@
* transactions that have the same call id as this
* dialog).
*/
- std::list<MRef<SipTransaction*> > getTransactions();//{return transactions;}
+ std::list<MRef<SipTransaction*> > getTransactions();
SipDialogState dialogState;
Modified: trunk/libmsip/include/libmsip/SipDialogConfig.h
===================================================================
--- trunk/libmsip/include/libmsip/SipDialogConfig.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipDialogConfig.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -96,12 +96,12 @@
void setRegisterExpires( std::string _expires );
void setRegisterExpires( int _expires );
std::string getRegisterExpires( );
- int getRegisterExpires_int( ) {return registerExpires;}
+ int getRegisterExpires_int( );
void setDefaultExpires( std::string _expires );
void setDefaultExpires( int _expires );
std::string getDefaultExpires( );
- int getDefaultExpires_int( ) {return defaultExpires;}
+ int getDefaultExpires_int( );
const SipUri getUri() const{ return uri; }
@@ -148,7 +148,7 @@
SipIdentity();
SipIdentity(const SipUri &sipuri);
- void setIdentityName(std::string n);//{identityIdentifier = n;}
+ void setIdentityName(std::string n);
void setSipUri(const SipUri &addr) { sipUri = addr; }
@@ -176,21 +176,12 @@
*/
std::string setSipProxy( bool autodetect, std::string userUri, std::string transport, std::string proxyAddr, int port );
- void setDoRegister(bool f){
- lock();
- registerToProxy=f;
- unlock();
- }
+ void setDoRegister(bool f);
- bool getDoRegister(){
- lock();
- bool ret = registerToProxy;
- unlock();
- return ret;
- }
+ bool getDoRegister();
- void lock(){mutex.lock();};
- void unlock(){mutex.unlock();};
+ void lock();
+ void unlock();
std::string getDebugString();
@@ -199,12 +190,7 @@
/**
This identities index number. Useful to identify it across minisip.
*/
- std::string getId() {
- lock();
- std::string ret = identityIdx;
- unlock();
- return ret;
- }
+ std::string getId();
std::string identityIdentifier;
@@ -226,11 +212,7 @@
/**
True if this identity is currently registered, false otherwise.
*/
- bool isRegistered() {
- lock();
- bool ret = currentlyRegistered;
- unlock();
- return ret;}
+ bool isRegistered();
void setSim(MRef<SipSim*> s){sim=s;}
Modified: trunk/libmsip/include/libmsip/SipDialogRegister.h
===================================================================
--- trunk/libmsip/include/libmsip/SipDialogRegister.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipDialogRegister.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -45,13 +45,13 @@
virtual std::string getMemObjectType() const {return "SipDialogRegister";}
- void updateFailCount(){failCount++;};
- uint32_t getFailCount(){return failCount;};
+ void updateFailCount();
+ uint32_t getFailCount();
bool hasPassword();
- bool getGuiFeedback(){return guiFeedback;}
- void setGuiFeedback(bool fb){guiFeedback=fb;}
+ bool getGuiFeedback();
+ void setGuiFeedback(bool fb);
void send_register(std::string branch);
private:
Modified: trunk/libmsip/include/libmsip/SipDialogUtils.h
===================================================================
--- trunk/libmsip/include/libmsip/SipDialogUtils.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipDialogUtils.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -46,23 +46,23 @@
bool LIBMSIP_API transitionMatch(
const std::string& packetType,
const SipSMCommand &command,
- int source/*=IGN*/,
- int destination/*=IGN*/,
+ int source,
+ int destination,
const std::string &respFilter="");
/** Match Sip responses */
bool LIBMSIP_API transitionMatchSipResponse(
const std::string& cseqMethod,
const SipSMCommand &command,
- int source/*=IGN*/,
- int destination/*=IGN*/,
+ int source,
+ int destination,
const std::string &respFilter="");
bool LIBMSIP_API transitionMatch(
const SipSMCommand &command,
const std::string &cmd_str,
- int source/*=SipSMCommand::dialog_layer*/,
- int destination/*=SipSMCommand::dialog_layer*/);
+ int source,
+ int destination);
#endif
Modified: trunk/libmsip/include/libmsip/SipHeader.h
===================================================================
--- trunk/libmsip/include/libmsip/SipHeader.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipHeader.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -96,9 +96,9 @@
SipHeaderParameter(std::string parseFrom);
SipHeaderParameter(std::string key, std::string value, bool hasEqual); //hasEqual is there to support ;lr
std::string getMemObjectType() const {return "SipHeaderParameter";}
- std::string getKey() const {return key;}
- std::string getValue() const {return value;}
- void setValue(std::string v){value=v;}
+ std::string getKey() const;
+ std::string getValue() const;
+ void setValue(std::string v);
std::string getString() const;
private:
@@ -114,55 +114,15 @@
virtual std::string getString() const =0;
int getType(){return type;}
- void setParameter(std::string key, std::string val){
- if (val.size()>0){
- MRef<SipHeaderParameter*> param = new SipHeaderParameter(key,val,true);
- addParameter(param);
- }else{
- removeParameter(key);
- }
- }
+ void setParameter(std::string key, std::string val);
- void addParameter(MRef<SipHeaderParameter*> p){
- //If key already exist, change the existing value
- //(a key can only exist once)
- for (int i=0; i< parameters.size();i++){
- if (parameters[i]->getKey()==p->getKey()){
- parameters[i]->setValue(p->getValue());
- //cerr<<"p->getValue() "+p->getValue()<<endl;
- return;
- }
- }
- parameters.push_back(p);
- }
+ void addParameter(MRef<SipHeaderParameter*> p);
- bool hasParameter(const std::string &key) const {
- for (int i=0; i< parameters.size();i++){
- if (parameters[i]->getKey()==key){
- return true;
- }
- }
- return false;
- }
+ bool hasParameter(const std::string &key) const;
- std::string getParameter(std::string key) const {
- for (int i=0; i< parameters.size();i++){
- if (parameters[i]->getKey()==key){
- return parameters[i]->getValue();
- }
- }
- return "";
- }
+ std::string getParameter(std::string key) const;
- void removeParameter(std::string key){
- for (int i=0; i< parameters.size(); i++){
- if (parameters[i]->getKey()==key){
- parameters.remove(i);
- i=0;
- }
- }
-
- }
+ void removeParameter(std::string key);
std::string getStringWithParameters() const ;
@@ -195,12 +155,9 @@
virtual std::string getMemObjectType() const {return "SipHeader";}
- int32_t getType() const {return type;}
- int getNoValues() const {return headerValues.size();}
- MRef<SipHeaderValue *> getHeaderValue(int i) const {
- assert(i < headerValues.size() );
- return headerValues[i];
- }
+ int32_t getType() const;
+ int getNoValues() const;
+ MRef<SipHeaderValue *> getHeaderValue(int i) const;
static MRef<SipHeader *> parseHeader(const std::string &buildFrom);
Modified: trunk/libmsip/include/libmsip/SipLayerDialog.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerDialog.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipLayerDialog.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -43,7 +43,7 @@
SipLayerDialog(MRef<SipCommandDispatcher*> dispatcher);
- void setDefaultDialogCommandHandler(MRef<SipSMCommandReceiver*> cb){defaultHandler=cb;}
+ void setDefaultDialogCommandHandler(MRef<SipSMCommandReceiver*> cb);
void addDialog(MRef<SipDialog*> d);
void removeTerminatedDialogs();
Modified: trunk/libmsip/include/libmsip/SipLayerTransport.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerTransport.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipLayerTransport.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -95,15 +95,15 @@
void addSocket(MRef<StreamSocket *> sock);
- std::string getLocalIP(){return localIP;};
+ std::string getLocalIP();
- int32_t getLocalUDPPort(){return localUDPPort;};
- int32_t getLocalTCPPort(){return localTCPPort;};
- int32_t getLocalTLSPort(){return localTLSPort;};
+ int32_t getLocalUDPPort();
+ int32_t getLocalTCPPort();
+ int32_t getLocalTLSPort();
- MRef<certificate_chain *> getCertificateChain(){ return cert_chain; };
- MRef<certificate*> getMyCertificate(){ return cert_chain->get_first(); };
- MRef<ca_db *> getCA_db () { return cert_db; };
+ MRef<certificate_chain *> getCertificateChain();
+ MRef<certificate*> getMyCertificate();
+ MRef<ca_db *> getCA_db ();
void udpSocketRead();
Modified: trunk/libmsip/include/libmsip/SipStackInternal.h
===================================================================
--- trunk/libmsip/include/libmsip/SipStackInternal.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipStackInternal.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -81,7 +81,7 @@
MRef<TimeoutProvider<std::string, MRef<StateMachine<SipSMCommand,std::string>*> > *> getTimeoutProvider();
MRef<SipTimers*> getTimers();
- MRef<SipStackConfig*> getStackConfig(){return config;}
+ MRef<SipStackConfig*> getStackConfig();
void addSupportedExtension(std::string extension);
std::string getAllSupportedExtensionsStr();
Modified: trunk/libmsip/include/libmsip/SipTransaction.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransaction.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipTransaction.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -93,17 +93,17 @@
void setBranch(std::string branch);
void send(MRef<SipMessage*> pack, bool addVia, std::string branch=""); // if not specified branch, use the attribute one - ok in most cases.
- void setSocket(Socket * sock){socket=sock;};
- MRef<Socket *> getSocket(){return socket;};
+ void setSocket(Socket * sock);
+ MRef<Socket *> getSocket();
- virtual std::string getMemObjectType() const {return "SipTransaction";}
- void setDebugTransType(std::string t){debugTransType = t;}
- std::string getDebugTransType(){return debugTransType;}
+ virtual std::string getMemObjectType() const;
+ void setDebugTransType(std::string t);
+ std::string getDebugTransType();
- int getCSeqNo(){return cSeqNo;}
- std::string getCSeqMethod(){return cSeqMethod;}
+ int getCSeqNo();
+ std::string getCSeqMethod();
- std::string getCallId(){return callId;}
+ std::string getCallId();
//The transition to cancel a transaction is common to all
//transactions and is defined in this class.
Modified: trunk/libmsip/include/libmsip/SipUri.h
===================================================================
--- trunk/libmsip/include/libmsip/SipUri.h 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/include/libmsip/SipUri.h 2006-11-17 16:29:13 UTC (rev 2914)
@@ -136,39 +136,23 @@
don't use if not valid.
If invalid and used, the getXXXString functions will return nothing
*/
- bool isValid() const { return validUri; };
+ bool isValid() const;
/**
Use at your own risk ... forces uri in a (in)valid state
*/
- void makeValid( bool valid ) { validUri = valid; };
+ void makeValid( bool valid );
void clear();
- void setParameter(const std::string &key, const std::string &val){
- parameters[ key ] = val;
- }
+ void setParameter(const std::string &key, const std::string &val);
- bool hasParameter(const std::string &key) const{
- std::map<std::string, std::string>::const_iterator iter;
- iter = parameters.find( key );
+ bool hasParameter(const std::string &key) const;
- return iter != parameters.end();
- }
+ std::string getParameter(const std::string &key) const;
- std::string getParameter(const std::string &key) const{
- std::map<std::string, std::string>::const_iterator iter;
- iter = parameters.find( key );
- if( iter != parameters.end() )
- return iter->second;
- else
- return "";
- }
+ void removeParameter(const std::string &key);
- void removeParameter(const std::string &key){
- parameters.erase( key );
- }
-
private:
std::string displayName;
std::string protocolId;
Modified: trunk/libmsip/source/SipAuthenticationDigest.cxx
===================================================================
--- trunk/libmsip/source/SipAuthenticationDigest.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/SipAuthenticationDigest.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -37,6 +37,15 @@
update( auth );
}
+const std::string &SipAuthenticationDigest::getRealm() const{
+ return realm;
+}
+
+bool SipAuthenticationDigest::getStale() const{
+ return stale;
+}
+
+
string unquote(string str){
if( str.length() > 1 && str[0] == '"' && str[str.length() - 1] == '"' )
return str.substr(1, str.length() - 2);
Modified: trunk/libmsip/source/SipDialogConfig.cxx
===================================================================
--- trunk/libmsip/source/SipDialogConfig.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/SipDialogConfig.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -124,7 +124,14 @@
return proxyUri;
}
+int SipProxy::getRegisterExpires_int( ) {
+ return registerExpires;
+}
+int SipProxy::getDefaultExpires_int( ) {
+ return defaultExpires;
+}
+
void SipProxy::setRegisterExpires( string _expires ) {
int r;
r = atoi( _expires.c_str() );
@@ -192,10 +199,47 @@
setIsRegistered (false);
}
+void SipIdentity::setDoRegister(bool f){
+ lock();
+ registerToProxy=f;
+ unlock();
+}
+
+bool SipIdentity::getDoRegister(){
+ lock();
+ bool ret = registerToProxy;
+ unlock();
+ return ret;
+}
+
+void SipIdentity::lock(){
+ mutex.lock();
+}
+
+void SipIdentity::unlock(){
+ mutex.unlock();
+}
+
+std::string SipIdentity::getId() {
+ lock();
+ std::string ret = identityIdx;
+ unlock();
+ return ret;
+}
+
+bool SipIdentity::isRegistered(){
+ lock();
+ bool ret = currentlyRegistered;
+ unlock();
+ return ret;
+}
+
+
+
#if 0
void SipIdentity::setSipUri(string addr){
if (addr.substr(0,4)=="sip:")
- addr = addr.substr(4);
+ addr = addr.substr(4);
if (addr.find("@")==string::npos){
#ifdef DEBUG_OUTPUT
cerr << "WARNING: Incomplete sip address: "<< addr<<endl;
Modified: trunk/libmsip/source/SipLayerDialog.cxx
===================================================================
--- trunk/libmsip/source/SipLayerDialog.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/SipLayerDialog.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -67,6 +67,10 @@
dialogListLock.unlock();
}
+void SipLayerDialog::setDefaultDialogCommandHandler(MRef<SipSMCommandReceiver*> cb){
+ defaultHandler=cb;
+}
+
//TODO: Optimize how dialogs are found based on callid parameter.
bool SipLayerDialog::handleCommand(const SipSMCommand &c){
assert(c.getDestination()==SipSMCommand::dialog_layer);
Modified: trunk/libmsip/source/SipLayerTransport.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransport.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/SipLayerTransport.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -863,7 +863,36 @@
}
}
+std::string SipLayerTransport::getLocalIP(){
+ return localIP;
+}
+int32_t SipLayerTransport::getLocalUDPPort(){
+ return localUDPPort;
+}
+
+int32_t SipLayerTransport::getLocalTCPPort(){
+ return localTCPPort;
+}
+
+int32_t SipLayerTransport::getLocalTLSPort(){
+ return localTLSPort;
+}
+
+MRef<certificate_chain *> SipLayerTransport::getCertificateChain(){
+ return cert_chain;
+}
+
+MRef<certificate*> SipLayerTransport::getMyCertificate(){
+ return cert_chain->get_first();
+}
+
+MRef<ca_db *> SipLayerTransport::getCA_db () {
+ return cert_db;
+}
+
+
+
#define UDP_MAX_SIZE 65536
void SipLayerTransport::udpSocketRead(){
@@ -1108,3 +1137,5 @@
return NULL;
}
+
+
Modified: trunk/libmsip/source/SipStackInternal.cxx
===================================================================
--- trunk/libmsip/source/SipStackInternal.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/SipStackInternal.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -152,6 +152,10 @@
return dispatcher;
}
+MRef<SipStackConfig*> SipStackInternal::getStackConfig(){
+ return config;
+}
+
void SipStackInternal::setDefaultDialogCommandHandler(MRef<SipSMCommandReceiver*> cb){
dispatcher->getLayerDialog()->setDefaultDialogCommandHandler(cb);
}
Modified: trunk/libmsip/source/SipUri.cxx
===================================================================
--- trunk/libmsip/source/SipUri.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/SipUri.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -387,6 +387,39 @@
return getParameter( "transport" );
}
+void SipUri::setParameter(const std::string &key, const std::string &val){
+ parameters[ key ] = val;
+}
+
+bool SipUri::hasParameter(const std::string &key) const{
+ std::map<std::string, std::string>::const_iterator iter;
+ iter = parameters.find( key );
+
+ return iter != parameters.end();
+}
+
+std::string SipUri::getParameter(const std::string &key) const{
+ std::map<std::string, std::string>::const_iterator iter;
+ iter = parameters.find( key );
+ if( iter != parameters.end() )
+ return iter->second;
+ else
+ return "";
+}
+
+void SipUri::removeParameter(const std::string &key){
+ parameters.erase( key );
+}
+
+bool SipUri::isValid() const {
+ return validUri;
+}
+
+void SipUri::makeValid( bool valid ) {
+ validUri = valid;
+}
+
+
ostream& operator << (ostream& os, const SipUri& uri){
return os << uri.getString();
}
Modified: trunk/libmsip/source/dialogs/SipDialog.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialog.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/dialogs/SipDialog.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -84,6 +84,14 @@
return callConfig;
}
+std::list<std::string> SipDialog::getRouteSet(){
+ return dialogState.routeSet;
+}
+
+std::string SipDialog::getCallId(){
+ return dialogState.callId;
+}
+
void SipDialog::handleTimeout(const string &c){
SipSMCommand cmd(
CommandString(dialogState.callId, c),
Modified: trunk/libmsip/source/dialogs/SipDialogRegister.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialogRegister.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/dialogs/SipDialogRegister.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -643,6 +643,22 @@
SipDialogRegister::~SipDialogRegister(){
}
+void SipDialogRegister::updateFailCount(){
+ failCount++;
+}
+
+uint32_t SipDialogRegister::getFailCount(){
+ return failCount;
+}
+
+bool SipDialogRegister::getGuiFeedback(){
+ return guiFeedback;
+}
+
+void SipDialogRegister::setGuiFeedback(bool fb){
+ guiFeedback=fb;
+}
+
bool SipDialogRegister::hasPassword(){
return getDialogConfig()->sipIdentity->getSipProxy()->sipProxyUsername!="" && getDialogConfig()->sipIdentity->getSipProxy()->sipProxyPassword!="";
}
Modified: trunk/libmsip/source/headers/SipHeader.cxx
===================================================================
--- trunk/libmsip/source/headers/SipHeader.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/headers/SipHeader.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -69,8 +69,18 @@
}
+std::string SipHeaderParameter::getKey() const {
+ return key;
+}
+std::string SipHeaderParameter::getValue() const {
+ return value;
+}
+void SipHeaderParameter::setValue(std::string v){
+ value=v;
+}
+
string SipHeaderParameter::getString() const{
if (hasEqual || value.size()>0){
return key+"="+value;
@@ -128,6 +138,19 @@
return ret;
}
+int32_t SipHeader::getType() const {
+ return type;
+}
+
+int SipHeader::getNoValues() const {
+ return headerValues.size();
+}
+
+MRef<SipHeaderValue *> SipHeader::getHeaderValue(int i) const {
+ assert(i < headerValues.size() );
+ return headerValues[i];
+}
+
void SipHeader::addHeaderValue(MRef<SipHeaderValue*> v){
massert(type == v->getType());
headerValues.push_back(v);
@@ -290,6 +313,57 @@
}
+void SipHeaderValue::setParameter(std::string key, std::string val){
+ if (val.size()>0){
+ MRef<SipHeaderParameter*> param = new SipHeaderParameter(key,val,true);
+ addParameter(param);
+ }else{
+ removeParameter(key);
+ }
+}
+
+void SipHeaderValue::addParameter(MRef<SipHeaderParameter*> p){
+ //If key already exist, change the existing value
+ //(a key can only exist once)
+ for (int i=0; i< parameters.size();i++){
+ if (parameters[i]->getKey()==p->getKey()){
+ parameters[i]->setValue(p->getValue());
+ //cerr<<"p->getValue() "+p->getValue()<<endl;
+ return;
+ }
+ }
+ parameters.push_back(p);
+}
+
+bool SipHeaderValue::hasParameter(const std::string &key) const {
+ for (int i=0; i< parameters.size();i++){
+ if (parameters[i]->getKey()==key){
+ return true;
+ }
+ }
+ return false;
+}
+
+
+std::string SipHeaderValue::getParameter(std::string key) const {
+ for (int i=0; i< parameters.size();i++){
+ if (parameters[i]->getKey()==key){
+ return parameters[i]->getValue();
+ }
+ }
+ return "";
+}
+
+void SipHeaderValue::removeParameter(std::string key){
+ for (int i=0; i< parameters.size(); i++){
+ if (parameters[i]->getKey()==key){
+ parameters.remove(i);
+ i=0;
+ }
+ }
+}
+
+
std::string SipHeaderValue::getStringWithParameters() const{
std::string parameterList;
int nparam = parameters.size();
Modified: trunk/libmsip/source/transactions/SipTransaction.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransaction.cxx 2006-11-17 16:25:52 UTC (rev 2913)
+++ trunk/libmsip/source/transactions/SipTransaction.cxx 2006-11-17 16:29:13 UTC (rev 2914)
@@ -158,6 +158,39 @@
}
+void SipTransaction::setSocket(Socket * sock){
+ socket=sock;
+}
+
+MRef<Socket *> SipTransaction::getSocket(){
+ return socket;
+}
+
+std::string SipTransaction::getMemObjectType() const {
+ return "SipTransaction";
+}
+
+void SipTransaction::setDebugTransType(std::string t){
+ debugTransType = t;
+}
+
+std::string SipTransaction::getDebugTransType(){
+ return debugTransType;
+}
+
+int SipTransaction::getCSeqNo(){
+ return cSeqNo;
+}
+
+std::string SipTransaction::getCSeqMethod(){
+ return cSeqMethod;
+}
+
+std::string SipTransaction::getCallId(){
+ return callId;
+}
+
+
void SipTransaction::send(MRef<SipMessage*> pack, bool addVia, string br){
if (br=="")
br = branch;
More information about the Minisip-devel
mailing list