"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/osipparser2/osip_parser_cfg.c" between
libosip2-5.0.0.tar.gz and libosip2-5.1.0.tar.gz

About: The GNU oSIP library is an implementation of SIP (RFC3261).

osip_parser_cfg.c  (libosip2-5.0.0):osip_parser_cfg.c  (libosip2-5.1.0)
skipping to change at line 27 skipping to change at line 27
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <osipparser2/internal.h> #include <osipparser2/internal.h>
#include <osipparser2/osip_port.h> #include <osipparser2/osip_port.h>
#include <osipparser2/osip_parser.h> #include <osipparser2/osip_parser.h>
#include "parser.h" #include "parser.h"
static __osip_message_config_t pconfig[NUMBER_OF_HEADERS]; static __osip_message_config_t pconfig[NUMBER_OF_HEADERS];
static __osip_message_config_commaseparated_t pconfig_commasep[NUMBER_OF_HEADERS _COMMASEPARATED];
/* The size of the hash table seems large for a limited number of possible entri es /* The size of the hash table seems large for a limited number of possible entri es
* The 'problem' is that the header name are too much alike for the osip_hash() function * The 'problem' is that the header name are too much alike for the osip_hash() function
* which gives a poor deviation. * which gives a poor deviation.
* Anyway, this mechanism improves the search time (from binary seach (log(n)) t o 1). * Anyway, this mechanism improves the search time (from binary seach (log(n)) t o 1).
*/ */
#ifndef HASH_TABLE_SIZE #ifndef HASH_TABLE_SIZE
#ifdef __amd64__ #ifdef __amd64__
#define HASH_TABLE_SIZE 150 #define HASH_TABLE_SIZE 150
skipping to change at line 62 skipping to change at line 63
s: Subject => NOT A SUPPORTED HEADER! will be s: Subject => NOT A SUPPORTED HEADER! will be
available in the list of unknown headers available in the list of unknown headers
t: To => ok t: To => ok
v: Via => ok v: Via => ok
*/ */
/* This method must be called before using the parser */ /* This method must be called before using the parser */
int int
parser_init (void) parser_init (void)
{ {
int i = 0; int i = 0;
int hname_length = sizeof (pconfig_commasep[0].hname);
memset (pconfig_commasep, 0, sizeof (pconfig_commasep));
/* rfc3261 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Accept");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "a");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Accept-Encoding");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Accept-Language");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Alert-Info");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Allow");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Authentication-Inf
o");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Call-Info");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Contact");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "m");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Content-Encoding")
;
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "e");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Content-Language")
;
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Error-Info");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "In-Reply-To");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Proxy-Require");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Record-Route");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Require");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Route");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Supported");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "k");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Unsupported");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Via");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "v");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Warning");
/* rfc3313 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Media-Authorizat
ion");
/* rfc3325 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Asserted-Identit
y");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Preferred-Identi
ty");
/* rfc3326 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Reason");
/* rfc3327 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Path");
/* rfc3329 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Security-Client");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Security-Server");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Security-Verify");
/* rfc3608 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Service-Route");
/* rfc3841 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Request-Dispositio
n");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "d");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Accept-Contact");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "a");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Reject-Contact");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "j");
/* rfc4412 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Resource-Priority"
);
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Accept-Resource-Pr
iority");
/* rfc5009 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Early-Media");
/* rfc5318 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Refused-URI-List
");
/* rfc5360 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Permission-Missing
");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Trigger-Consent");
/* rfc6050 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Asserted-Service
");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Preferred-Servic
e");
/* rfc6086 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Recv-Info");
/* rfc6665 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Allow-Events");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "u");
/* rfc6794 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Policy-ID");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Policy-Contact");
/* rfc6809 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Feature-Caps");
/* rfc7044 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "History-Info");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "Accept");
/* rfc7315 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Associated-URI")
;
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Visited-Network-
ID");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Access-Network-I
nfo");
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "P-Charging-Functio
n-Addresses");
/* rfc7433 */
snprintf (pconfig_commasep[i++].hname, hname_length, "%s", "User-to-User");
i = 0;
#ifndef MINISIZE #ifndef MINISIZE
pconfig[i].hname = ACCEPT; pconfig[i].hname = ACCEPT;
pconfig[i].ignored_when_invalid = 1; pconfig[i].ignored_when_invalid = 1;
pconfig[i++].setheader = (&osip_message_set_accept); pconfig[i++].setheader = (&osip_message_set_accept);
pconfig[i].hname = ACCEPT_ENCODING; pconfig[i].hname = ACCEPT_ENCODING;
pconfig[i].ignored_when_invalid = 1; pconfig[i].ignored_when_invalid = 1;
pconfig[i++].setheader = (&osip_message_set_accept_encoding); pconfig[i++].setheader = (&osip_message_set_accept_encoding);
pconfig[i].hname = ACCEPT_LANGUAGE; pconfig[i].hname = ACCEPT_LANGUAGE;
pconfig[i].ignored_when_invalid = 1; pconfig[i].ignored_when_invalid = 1;
pconfig[i++].setheader = (&osip_message_set_accept_language); pconfig[i++].setheader = (&osip_message_set_accept_language);
skipping to change at line 203 skipping to change at line 308
/* oops, conflict!-> change the hash table or use another hash function si ze */ /* oops, conflict!-> change the hash table or use another hash function si ze */
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "conflict wi th current hashtable size\n")); OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "conflict wi th current hashtable size\n"));
return OSIP_UNDEFINED_ERROR; return OSIP_UNDEFINED_ERROR;
} }
} }
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
int
parser_add_comma_separated_header (const char *hname)
{
int i;
for (i = 0; i < NUMBER_OF_HEADERS_COMMASEPARATED; i++) {
if (pconfig_commasep[i].hname[0] == '\0') {
snprintf (pconfig_commasep[i].hname, sizeof (pconfig_commasep[i].hname), "
%s", hname);
return OSIP_SUCCESS;
}
}
return OSIP_UNDEFINED_ERROR;
}
int
__osip_message_is_header_comma_separated (const char *hname)
{
int i;
for (i = 0; i < NUMBER_OF_HEADERS_COMMASEPARATED; i++) {
if (pconfig_commasep[i].hname[0] == '\0')
break;
if (osip_strcasecmp (pconfig_commasep[i].hname, hname) == 0)
return OSIP_SUCCESS;
}
return OSIP_UNDEFINED_ERROR;
}
/* improved look-up mechanism /* improved look-up mechanism
precondition: hname is all lowercase */ precondition: hname is all lowercase */
int int
__osip_message_is_known_header (const char *hname) __osip_message_is_known_header (const char *hname)
{ {
unsigned long hash; unsigned long hash;
int result = -1; int result = -1;
int index; int index;
 End of changes. 4 change blocks. 
0 lines changed or deleted 151 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)