示例#1
0
/* Handles setting of the snmp community string. */
int set_snmp_community(modparam_t type, void *val)
{
	if(!stringHandlerSanityCheck(type, val, "snmpCommunity")) {
		return -1;
	}

	snmp_community = (char *)val;

	return 0;
}
示例#2
0
/*! This function is called whenever the kamailio.cfg file specifies the
 * snmpgetPath parameter.  The function will set the snmpget_path parameter. */
int set_snmpget_path(modparam_t type, void *val)
{
	if(!stringHandlerSanityCheck(type, val, "snmpgetPath")) {
		return -1;
	}

	snmpget_path = (char *)val;

	return 0;
}
示例#3
0
/* If type==STR_PARAM and stringParam is valid, this function will overwrite
 * kamailioEntityType with a bit value corresponding to the IETF's RFC  for 
 * the SIP MIB.  (Textual Convention SipEntityRole).  Anything else is
 * considered an error.
 *
 * Returns 0 on success, -1 on failure.  
 */
int handleSipEntityType( modparam_t type, void* val) 
{
	
	/* By default we start off as "other". */
	static char firstTime = 1;

	if (!stringHandlerSanityCheck(type, val, "sipEntityType")) {
		return -1;
	}

	char *strEntityType = (char *)val;

	/* This is our first time through this function, so we need to change
	 * kamailioEntityType from its default to 0, allowing our bitmasks below
	 * to work as expected. */
	if (firstTime) {
		firstTime = 0;
		kamailioEntityType = 0;
	}	

	/* Begin our string comparison.  This isn't the most efficient approach,
	 * but we don't expect this function to be called anywhere other than at
	 * startup.  So our inefficiency is outweiged by simplicity 
	 */
	if (strcasecmp(strEntityType, "other") == 0) {
		kamailioEntityType |= TC_SIP_ENTITY_ROLE_OTHER;
	}
	else if (strcasecmp(strEntityType, "userAgent") == 0) {
		kamailioEntityType |= TC_SIP_ENTITY_ROLE_USER_AGENT; 
	}
	else if (strcasecmp(strEntityType, "proxyServer") == 0) {
		kamailioEntityType |= TC_SIP_ENTITY_ROLE_PROXY_SERVER; 
	}
	else if (strcasecmp(strEntityType, "redirectServer") == 0) {
		kamailioEntityType |= TC_SIP_ENTITY_ROLE_REDIRECT_SERVER;
	}
	else if (strcasecmp(strEntityType, "registrarServer") == 0) {
		kamailioEntityType |= TC_SIP_ENTITY_ROLE_REGISTRAR_SERVER;
	}
	else if (strcasecmp(strEntityType, "edgeproxyServer") == 0) {
		kamailioEntityType |= TC_SIP_ENTITY_ROLE_EDGEPROXY_SERVER;
	}
	else if (strcasecmp(strEntityType, "sipcaptureServer") == 0) {
		kamailioEntityType |= TC_SIP_ENTITY_ROLE_SIPCAPTURE_SERVER;
	}
	else {
		LM_ERR("The configuration file specified sipEntityType=%s,"
				" an unknown type\n", strEntityType);
		return -1;
	}

	return 0;
}