資源簡介
一個SIP協議棧的實現源碼,對sip協議進行了完整的封裝。
Implementation of a SIP protocol stack source code, to sip protocol complete package.
代碼片段和文件信息
/*
?*??This?program?is?free?software;?you?can?redistribute?it?and/or?modify
?*??it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
?*??the?Free?Software?Foundation;?either?version?2?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?General?Public?License?for?more?details.
?*
?*??You?should?have?received?a?copy?of?the?GNU?General?Public?License
?*??along?with?this?program;?if?not?write?to?the?Free?Software
?*??Foundation?Inc.?59?Temple?Place?Suite?330?Boston?MA??02111-1307??USA
?*
?*??Authors?:?Benjamin?GAUTHIER?-?24?Mar?2004
?*????????????Joseph?BANINO
?*????????????Olivier?JACQUES
?*????????????Richard?GAYRAUD
?*????????????From?Hewlett?Packard?Company.
?*????????????Guillaume?Teissier?from?FTR&D
?*/
#include?“sipp.hpp“
#include?
#ifdef?PCAPPLAY
#include?“prepare_pcap.h“
#endif
static?const?char*?strIntCmd(CAction::T_IntCmdType?type)
{
????switch?(type)
????{
????????case?CAction::E_INTCMD_STOPCALL:
????????????return?“stop_call“;
????????case?CAction::E_INTCMD_STOP_ALL:
????????????return?“stop_gracefully“;
????????case?CAction::E_INTCMD_STOP_NOW:
????????????return?“stop_now“;
????????default:
????????case?CAction::E_INTCMD_INVALID:
????????????return?“invalid“;
????}
????return?“invalid“;
}
const?char?*?CAction::comparatorToString(T_Comparator?comp)?{
???switch(comp)?{
?????case?E_C_EQ:
???????return?“==“;
?????case?E_C_NE:
???????return?“!=“;
?????case?E_C_GT:
???????return?“>“;
?????case?E_C_LT:
???????return?“<“;
?????case?E_C_GEQ:
???????return?“>=“;
?????case?E_C_LEQ:
???????return?“<=“;
?????default:
???????return?“invalid“;
???}
}
bool?CAction::compare(VariableTable?*variableTable)?{
??double?lhs?=?variableTable->getVar(M_varInId)->getDouble();
??double?rhs?=?M_doubleValue;
??switch(M_comp)?{
????case?E_C_EQ:
??????return?lhs?==?rhs;
????case?E_C_NE:
??????return?lhs?!=?rhs;
????case?E_C_GT:
??????return?lhs?>?rhs;
????case?E_C_LT:
??????return?lhs?????case?E_C_GEQ:
??????return?lhs?>=?rhs;
????case?E_C_LEQ:
??????return?lhs?<=?rhs;
????default:
??????ERROR(“Internal?error:?Invalid?comparison?type?%d“?M_comp);
??????return?false;?/*?Shut?up?warning.?*/
??}
}
void?CAction::afficheInfo()
{
??if?(M_action?==?E_AT_ASSIGN_FROM_REGEXP)?{
????if(M_lookingPlace?==?E_LP_MSG)?{
??????printf(“Type[%d]?-?regexp[%s]?where[%s]?-?checkIt[%d]?-?$%s“
?????????????M_action
?????M_regularexpression
?????????????“Full?Msg“
?????????????M_checkIt
???????display_scenario->allocVars->getName(M_varId));
????}?else?{
??????printf(“Type[%d]?-?regexp[%s]?where[%s-%s]?-?checkIt[%d]?-?$%d“
?????????????M_action
?????M_regularexpression
?????????????“Header“
?????????????M_lookingChar
?????????????M_checkIt?display_scenario->allocVars->getName(M_varId));
????}
??}?else?if?(M_action?==?
評論
共有 條評論