Skip to content

Commit

Permalink
Merge pull request #443 from linuxmaniac/vseva/cfgt
Browse files Browse the repository at this point in the history
modules/cfgt: debugger config test support
  • Loading branch information
linuxmaniac committed Dec 15, 2015
2 parents e0f7a0c + ef5ba34 commit 393385a
Show file tree
Hide file tree
Showing 17 changed files with 1,951 additions and 14 deletions.
17 changes: 17 additions & 0 deletions modules/cfgt/Makefile
@@ -0,0 +1,17 @@
#
# cfgt module makefile
#
# WARNING: do not run this directly, it should be run by the master Makefile

include ../../Makefile.defs
auto_gen=
NAME=cfgt.so
LIBS=

DEFS+=-DKAMAILIO_MOD_INTERFACE

SERLIBPATH=../../lib
SER_LIBS+=$(SERLIBPATH)/kcore/kcore
SER_LIBS+=$(SERLIBPATH)/srutils/srutils

include ../../Makefile.modules
126 changes: 126 additions & 0 deletions modules/cfgt/README
@@ -0,0 +1,126 @@
cfgt Module

Victor Seva

sipwise.com

Edited by

Victor Seva

<linuxmaniac@torreviejawireless.org>

Copyright � 2015 Victor Seva (sipwise.com)
__________________________________________________________________

Table of Contents

1. Admin Guide

1. Overview
2. Dependencies

2.1. Kamailio Modules
2.2. External Libraries or Applications

3. Parameters

3.1. basedir (string)
3.2. mask (int)
3.3. callid_prefix (string)

List of Examples

1.1. Set cfgtrace parameter
1.2. Set mask parameter
1.3. Set callid_prefix parameter

Chapter 1. Admin Guide

Table of Contents

1. Overview
2. Dependencies

2.1. Kamailio Modules
2.2. External Libraries or Applications

3. Parameters

3.1. basedir (string)
3.2. mask (int)
3.3. callid_prefix (string)

1. Overview

This module provides a report of the way Kamailio SIP Server Platform
configuration has been executed as part of a unit test for different
SIP scenarios.

In order to identify defferent scenarios a prefix string should be used
at Call-ID header.

2. Dependencies

2.1. Kamailio Modules
2.2. External Libraries or Applications

2.1. Kamailio Modules

The following modules must be loaded before this module:
* None.

2.2. External Libraries or Applications

The following libraries or applications must be installed before
running Kamailio with this module loaded:
* None.

3. Parameters

3.1. basedir (string)
3.2. mask (int)
3.3. callid_prefix (string)

3.1. basedir (string)

Control where the config reports should be stored. The dir must exists
and Kamailio SIP Server Platform must have perms to write on it.

Default value is "/tmp".

Example 1.1. Set cfgtrace parameter
...
modparam("cfgt", "basedir", "/var/run/kamailio/cfgtest")
...

3.2. mask (int)

mask - Control the type of vars it should display in the report:
* 1 - dump null values
* 2 - dump avp vars
* 4 - dump script vars
* 8 - dump xavp vars
* 16 - dump DP_OTHER vars
* 32 - dump ALL vars

Default value is "32" (ALL).

Example 1.2. Set mask parameter
...
# dump xavp(8) and avp(4) vars
modparam("cfgt", "mask", 12)
...

3.3. callid_prefix (string)

Prefix used to indentify test scenario messages. Last char of the
string will be used as delimiter.

Default value is "NGCP%" (using "%" as delimiter).

Example 1.3. Set callid_prefix parameter
...
# using '%' as delimiter
modparam("cfgt", "callid_prefix", "TEST-ID%")
...
45 changes: 45 additions & 0 deletions modules/cfgt/cfgt.c
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2015 Victor Seva (sipwise.com)
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio 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
*
* Kamailio 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
*/
#include "cfgt_mod.h"
#include "cfgt.h"
#include "cfgt_int.h"

/*!
* \brief cfgt module API export bind function
* \param api cfgt API
* \return 0 on success, -1 on failure
*/
int bind_cfgt(cfgt_api_t* api)
{
if (!api) {
LM_ERR("invalid parameter value\n");
return -1;
}
if (init_flag==0) {
LM_ERR("configuration error - trying to bind to cfgt module"
" before being initialized\n");
return -1;
}

api->cfgt_process_route = cfgt_process_route;
return 0;
}
40 changes: 40 additions & 0 deletions modules/cfgt/cfgt.h
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2015 Victor Seva (sipwise.com)
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio 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
*
* Kamailio 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
*/

#ifndef _CFGT_BIND_H
#define _CFGT_BIND_H

#include "../../sr_module.h"

/* export not usable from scripts */
#define NO_SCRIPT -1

typedef int (*cfgt_process_route_f)(struct sip_msg *msg, struct action *a);

typedef struct cfgt_api {
cfgt_process_route_f cfgt_process_route;
} cfgt_api_t;

/*! cfgt API export bind function */
typedef int (*bind_cfgt_t)(cfgt_api_t* api);

#endif

0 comments on commit 393385a

Please sign in to comment.