SIP_METHOD_MESSAGE = 12, // 0x0800,
SIP_METHOD_NOTIFY = 13, // 0x1000,
SIP_METHOD_PRACK = 14, // 0x2000,
- SIP_METHOD_USER_DEFINE = 15, // 0x4000,
+ SIP_METHOD_PUBLISH = 15, // 0x4000,
+ SIP_METHOD_REPLACE = 16,
+ SIP_METHOD_USER_DEFINE = 17,
SIP_METHOD_USER_DEFINE_MAX = 32// 0x80000000,
};
/*
* method names defined by standard, 14 methods defined up to Mar. 2011
- * The first 6 methods are standard defined by RFC3261
*/
SIPMethod StandardMethods[] =
{ "message", SIP_METHOD_MESSAGE },
{ "notify", SIP_METHOD_NOTIFY },
{ "prack", SIP_METHOD_PRACK },
+ { "publish", SIP_METHOD_PUBLISH },
+ { "replace", SIP_METHOD_REPLACE },
{ nullptr, SIP_METHOD_NULL }
};
static SIPMethodsFlag currentUseDefineMethod = SIP_METHOD_USER_DEFINE;
+void reset_currentUseDefineMethod()
+{
+ currentUseDefineMethod = SIP_METHOD_USER_DEFINE;
+}
+
static int SIP_findMethod(const char* token, SIPMethod* methods)
{
int i = 0;
return METHOD_NOT_FOUND;
}
-/*
- * The first 6 methods are standard defined by RFC3261
- * We use those first 6 methods as default
- *
- */
-void SIP_SetDefaultMethods(SIP_PROTO_CONF* config)
-{
- int i;
- config->methodsConfig = SIP_METHOD_DEFAULT;
- for (i = 0; i < 6; i++)
- {
- SIP_AddMethodToList(StandardMethods[i].name,
- StandardMethods[i].methodFlag, &config->methods);
- }
-}
-
/********************************************************************
* Function: SIP_ParseMethods()
*
#include "framework/counts.h"
#include "sip_common.h"
-#define SIP_METHOD_DEFAULT 0x003f
+#define SIP_METHOD_DEFAULT 0x3fff
#define SIP_METHOD_ALL 0xffffffff
#define SIP_STATUS_CODE_LEN (3)
void SIP_ParseMethods(
const char* cur_tokenp, uint32_t* methodsConfig, SIPMethodlist* pmethods);
-// Sets the Default method lists
-void SIP_SetDefaultMethods(SIP_PROTO_CONF* config);
+void reset_currentUseDefineMethod();
// API to add a user defined method to SIP config
SIPMethodNode* SIP_AddUserDefinedMethod(
#endif
#include "log/messages.h"
+#include "sip_config.h"
#include "sip_module.h"
#include <cassert>
#define SIP_EVENT_UNKOWN_METHOD_STR "method is unknown"
#define SIP_EVENT_MAX_DIALOGS_IN_A_SESSION_STR "maximum dialogs within a session reached"
-#define default_methods "invite cancel ack bye register options"
+#define default_methods "invite cancel ack bye register options refer subscribe update join info message notify prack publish replace"
static const Parameter s_params[] =
{
{ CountType::SUM, "message", "message" },
{ CountType::SUM, "notify", "notify" },
{ CountType::SUM, "prack", "prack" },
+ { CountType::SUM, "publish", "publish" },
+ { CountType::SUM, "replace", "replace" },
{ CountType::SUM, "total_responses", "total responses" },
{ CountType::SUM, "code_1xx", "1xx" },
{ CountType::SUM, "code_2xx", "2xx" },
bool SipModule::set(const char*, Value& v, SnortConfig*)
{
+ reset_currentUseDefineMethod();
+
if ( v.is("ignore_call_channel") )
conf->ignoreChannel = v.get_bool();
conf->methodsConfig = SIP_METHOD_NULL;
conf->methods = nullptr;
- sip_methods = default_methods;
return true;
}
while ( v.get_next_token(tok) )
SIP_ParseMethods(tok.c_str(), &conf->methodsConfig, &conf->methods);
}
- /*If no methods defined, use the default*/
- if (SIP_METHOD_NULL == conf->methodsConfig)
- {
- SIP_SetDefaultMethods(conf);
- }
-
return true;
}