Begin implementing SIP MESSAGE.

General update ...
This commit is contained in:
bossiel 2010-01-07 09:12:56 +00:00
parent 421da36b1a
commit fe7c0e9869
88 changed files with 108248 additions and 73576 deletions

View File

@ -148,7 +148,7 @@ static void* tsk_buffer_create(void * self, va_list * app)
if(data && size)
{
buffer->data = tsk_calloc((size+1), sizeof(char*));
buffer->data = tsk_calloc((size+1), sizeof(uint8_t));
memcpy(buffer->data, data, size);
buffer->size = size;
}

View File

@ -162,7 +162,7 @@ int tsk_condwait_timedwait(tsk_condwait_handle_t* handle, uint64_t ms)
{
if(ret == TIMED_OUT)
{
TSK_DEBUG_INFO("WaitForSingleObject function timedout: %d", ret);
//TSK_DEBUG_INFO("WaitForSingleObject function timedout: %d", ret);
}
else
{

View File

@ -145,6 +145,8 @@ typedef tsk_list_t tsip_dialogs_L_t;
tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* method);
int tsip_dialog_request_send(const tsip_dialog_t *self, tsip_request_t* request);
tsip_response_t *tsip_dialog_response_new(const tsip_dialog_t *self, short status, const char* phrase, const tsip_request_t* request);
int tsip_dialog_response_send(const tsip_dialog_t *self, tsip_response_t* response);
int tsip_dialog_get_newdelay(tsip_dialog_t *self, const tsip_response_t* response);

View File

@ -35,7 +35,7 @@
#include "tsip.h"
#include "tinysip/dialogs/tsip_dialog.h"
#include "tsk_object.h"
#include "tsk_safeobj.h"
#include "tsk_list.h"
TSIP_BEGIN_DECLS
@ -50,12 +50,18 @@ typedef struct tsip_dialog_layer_s
const tsip_stack_handle_t *stack;
tsip_dialogs_L_t *dialogs;
TSK_DECLARE_SAFEOBJ;
}
tsip_dialog_layer_t;
typedef tsk_list_t tsip_dialog_layers_L_t;
int tsip_dialog_layer_register(tsip_dialog_layer_t *self, const tsip_operation_handle_t *operation);
//const tsip_dialog_t* tsip_dialog_layer_find(tsip_dialog_layer_t *self, const char* callid, const char* to_tag, const char* from_tag);
int tsip_dialog_layer_handle_msg(const tsip_dialog_layer_t *self, const tsip_message_t* message);
TINYSIP_GEXTERN const void *tsip_dialog_layer_def_t;

View File

@ -0,0 +1,76 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_messager.h
* @brief SIP dialog MESSAGE.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYSIP_DIALOG_MESSAGE_H
#define TINYSIP_DIALOG_MESSAGE_H
#include "tinysip_config.h"
#include "tinysip/dialogs/tsip_dialog.h"
#include "tinysip/smc/tsip_dialog_message_sm.h"
TSIP_BEGIN_DECLS
#define TSIP_DIALOG_MESSAGE_CREATE(stack, operation) tsk_object_new(tsip_dialog_message_def_t, (const tsip_stack_handle_t *)stack, (const tsip_operation_handle_t*) operation)
#define TSIP_DIALOG_MESSAGE_SAFE_FREE(self) tsk_object_unref(self), self = 0
#define TSIP_DIALOG_MESSAGE(self) ((tsip_dialog_message_t*)(self))
typedef struct tsip_dialog_message
{
TSIP_DECLARE_DIALOG;
struct tsip_dialog_messageContext _fsm;
tsip_message_t *msg;
unsigned sender:1;
}
tsip_dialog_message_t;
//int tsip_dialog_message_send(tsip_dialog_message_t *self);
//int tsip_dialog_message_recv(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Started_2_Sending_X_send(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Started_2_Receiving_X_recv(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Sending_2_Sending_X_1xx(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Sending_2_Terminated_X_2xx(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Sending_2_Sending_X_401_407_421_494(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Sending_2_Terminated_X_300_to_699(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Sending_2_Terminated_X_cancel(tsip_dialog_message_t *self);
void tsip_dialog_message_Receiving_2_Terminated_X_accept(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Receiving_2_Terminated_X_reject(tsip_dialog_message_t *self, const tsip_message_t *message);
void tsip_dialog_message_Any_2_Terminated_X_transportError(tsip_dialog_message_t *self);
void tsip_dialog_message_OnTerminated(tsip_dialog_message_t *self);
TINYSIP_GEXTERN const void *tsip_dialog_message_def_t;
TSIP_END_DECLS
#endif /* TINYSIP_DIALOG_MESSAGE_H */

View File

@ -53,7 +53,7 @@ typedef struct tsip_dialog_register
}
tsip_dialog_register_t;
void tsip_dialog_register_init(tsip_dialog_register_t *self);
//void tsip_dialog_register_init(tsip_dialog_register_t *self);
int tsip_dialog_register_start(tsip_dialog_register_t *self);
void tsip_dialog_register_Started_2_Trying_X_send(tsip_dialog_register_t *self);

View File

@ -35,6 +35,17 @@
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_CONTENT_TYPE_CREATE
* Creates new sip 'Content-Type' header. You must call @ref TSIP_HEADER_CONTENT_TYPE_SAFE_FREE to free the header.
* @sa TSIP_HEADER_CONTENT_TYPE_SAFE_FREE.
*/
/**@def TSIP_HEADER_CONTENT_TYPE_SAFE_FREE
* Safely free a sip 'Content-Type' header previously created using TSIP_HEADER_CONTENT_TYPE_CREATE.
* @sa TSIP_HEADER_CONTENT_TYPE_CREATE.
*/
#define TSIP_HEADER_CONTENT_TYPE_CREATE() tsk_object_new(tsip_header_Content_Type_def_t)
#define TSIP_HEADER_CONTENT_TYPE_SAFE_FREE(self) tsk_object_unref(self), self = 0
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
@ -42,15 +53,36 @@ TSIP_BEGIN_DECLS
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF= Content-Type / c
/// Content-Type = ( "Content-Type" / "c" ) HCOLON media-type
/// media-type = m-type SLASH m-subtype *( SEMI m-parameter)
/// m-type = discrete-type / composite-type
/// discrete-type = "text" / "image" / "audio" / "video" / "application" / extension-token
/// composite-type = "message" / "multipart" / extension-token
/// extension-token = ietf-token / x-token
/// ietf-token = token
/// x-token = "x-" token
/// m-subtype = extension-token / iana-token
/// iana-token = token
/// m-parameter = m-attribute EQUAL m-value
/// m-attribute = token
/// m-value = token / quoted-string
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_Content_Type_s
{
TSIP_DECLARE_HEADER;
char* type;
}
tsip_header_Content_Type_t;
tsip_header_Content_Type_t *tsip_header_Content_Type_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Content_Type_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_CONTENT_TYPE_H_ */

View File

@ -36,7 +36,7 @@
TSIP_BEGIN_DECLS
TINYSIP_API TSIP_BOOLEAN tsip_message_parse(tsip_ragel_state_t *state, tsip_message_t *result);
TINYSIP_API TSIP_BOOLEAN tsip_message_parse(tsip_ragel_state_t *state, tsip_message_t **result);
TSIP_END_DECLS

View File

@ -0,0 +1,69 @@
/*
* ex: set ro:
* DO NOT EDIT.
* generated by smc (http://smc.sourceforge.net/)
* from file : tsip_dialog_message.sm
*/
#ifndef _H_TSIP_DIALOG_MESSAGE_SM
#define _H_TSIP_DIALOG_MESSAGE_SM
#include <statemap.h>
struct tsip_dialog_message;
struct tsip_dialog_messageContext;
struct tsip_dialog_messageState
{
void(*Entry)(struct tsip_dialog_messageContext*);
void(*sm_1xx)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_2xx)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_300_to_699)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_401_407_421_494)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_accept)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_cancel)(struct tsip_dialog_messageContext*);
void(*sm_error)(struct tsip_dialog_messageContext*);
void(*sm_receive)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_reject)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_send)(struct tsip_dialog_messageContext*, const tsip_message_t*);
void(*sm_transportError)(struct tsip_dialog_messageContext*);
void(*Default)(struct tsip_dialog_messageContext*);
STATE_MEMBERS
};
extern const struct tsip_dialog_messageState tsip_dialog_message_Started;
extern const struct tsip_dialog_messageState tsip_dialog_message_Sending;
extern const struct tsip_dialog_messageState tsip_dialog_message_Receiving;
extern const struct tsip_dialog_messageState tsip_dialog_message_Terminated;
struct tsip_dialog_messageContext
{
FSM_MEMBERS(tsip_dialog_message)
struct tsip_dialog_message *_owner;
};
extern void tsip_dialog_messageContext_Init(struct tsip_dialog_messageContext*, struct tsip_dialog_message*);
extern void tsip_dialog_messageContext_EnterStartState(struct tsip_dialog_messageContext*);
extern void tsip_dialog_messageContext_sm_1xx(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_2xx(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_300_to_699(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_401_407_421_494(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_accept(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_cancel(struct tsip_dialog_messageContext*);
extern void tsip_dialog_messageContext_sm_error(struct tsip_dialog_messageContext*);
extern void tsip_dialog_messageContext_sm_receive(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_reject(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_send(struct tsip_dialog_messageContext*, const tsip_message_t*);
extern void tsip_dialog_messageContext_sm_transportError(struct tsip_dialog_messageContext*);
#endif
/*
* Local variables:
* buffer-read-only: t
* End:
*/

View File

@ -21,9 +21,9 @@ struct tsip_transac_nictState
void(*sm_1xx)(struct tsip_transac_nictContext*, const tsip_message_t*);
void(*sm_200_to_699)(struct tsip_transac_nictContext*, const tsip_message_t*);
void(*sm_send)(struct tsip_transac_nictContext*);
void(*sm_timerE)(struct tsip_transac_nictContext*, tsk_timer_id_t);
void(*sm_timerF)(struct tsip_transac_nictContext*, tsk_timer_id_t);
void(*sm_timerK)(struct tsip_transac_nictContext*, tsk_timer_id_t);
void(*sm_timerE)(struct tsip_transac_nictContext*);
void(*sm_timerF)(struct tsip_transac_nictContext*);
void(*sm_timerK)(struct tsip_transac_nictContext*);
void(*sm_transportError)(struct tsip_transac_nictContext*);
void(*Default)(struct tsip_transac_nictContext*);
@ -48,9 +48,9 @@ extern void tsip_transac_nictContext_EnterStartState(struct tsip_transac_nictCon
extern void tsip_transac_nictContext_sm_1xx(struct tsip_transac_nictContext*, const tsip_message_t*);
extern void tsip_transac_nictContext_sm_200_to_699(struct tsip_transac_nictContext*, const tsip_message_t*);
extern void tsip_transac_nictContext_sm_send(struct tsip_transac_nictContext*);
extern void tsip_transac_nictContext_sm_timerE(struct tsip_transac_nictContext*, tsk_timer_id_t);
extern void tsip_transac_nictContext_sm_timerF(struct tsip_transac_nictContext*, tsk_timer_id_t);
extern void tsip_transac_nictContext_sm_timerK(struct tsip_transac_nictContext*, tsk_timer_id_t);
extern void tsip_transac_nictContext_sm_timerE(struct tsip_transac_nictContext*);
extern void tsip_transac_nictContext_sm_timerF(struct tsip_transac_nictContext*);
extern void tsip_transac_nictContext_sm_timerK(struct tsip_transac_nictContext*);
extern void tsip_transac_nictContext_sm_transportError(struct tsip_transac_nictContext*);
#endif

View File

@ -18,9 +18,9 @@ struct tsip_transac_nistState
{
void(*Entry)(struct tsip_transac_nistContext*);
void(*sm_send_1xx)(struct tsip_transac_nistContext*, const tsip_message_t*);
void(*sm_send_200_to_699)(struct tsip_transac_nistContext*, const tsip_message_t*);
void(*sm_send_response)(struct tsip_transac_nistContext*, const tsip_message_t*);
void(*sm_recv_request)(struct tsip_transac_nistContext*, const tsip_request_t*);
void(*sm_send_1xx)(struct tsip_transac_nistContext*, const tsip_request_t*);
void(*sm_send_200_to_699)(struct tsip_transac_nistContext*, const tsip_request_t*);
void(*sm_timerJ)(struct tsip_transac_nistContext*);
void(*sm_transportError)(struct tsip_transac_nistContext*);
@ -29,6 +29,7 @@ struct tsip_transac_nistState
STATE_MEMBERS
};
extern const struct tsip_transac_nistState tsip_transac_nist_Started;
extern const struct tsip_transac_nistState tsip_transac_nist_Trying;
extern const struct tsip_transac_nistState tsip_transac_nist_Proceeding;
extern const struct tsip_transac_nistState tsip_transac_nist_Completed;
@ -42,9 +43,9 @@ struct tsip_transac_nistContext
extern void tsip_transac_nistContext_Init(struct tsip_transac_nistContext*, struct tsip_transac_nist*);
extern void tsip_transac_nistContext_EnterStartState(struct tsip_transac_nistContext*);
extern void tsip_transac_nistContext_sm_send_1xx(struct tsip_transac_nistContext*, const tsip_message_t*);
extern void tsip_transac_nistContext_sm_send_200_to_699(struct tsip_transac_nistContext*, const tsip_message_t*);
extern void tsip_transac_nistContext_sm_send_response(struct tsip_transac_nistContext*, const tsip_message_t*);
extern void tsip_transac_nistContext_sm_recv_request(struct tsip_transac_nistContext*, const tsip_request_t*);
extern void tsip_transac_nistContext_sm_send_1xx(struct tsip_transac_nistContext*, const tsip_request_t*);
extern void tsip_transac_nistContext_sm_send_200_to_699(struct tsip_transac_nistContext*, const tsip_request_t*);
extern void tsip_transac_nistContext_sm_timerJ(struct tsip_transac_nistContext*);
extern void tsip_transac_nistContext_sm_transportError(struct tsip_transac_nistContext*);

View File

@ -38,18 +38,21 @@
#include "tinysip/dialogs/tsip_dialog.h"
#include "tsk_object.h"
#include "tsk_safeobj.h"
#include "tsk_list.h"
TSIP_BEGIN_DECLS
#define TSIP_TRANSAC(self) ((tsip_transac_t*)(self))
#define TSIP_TRANSAC_GET_TYPE(self) TSIP_TRANSAC(self)->type
#define TSIP_TRANSAC(self) ((tsip_transac_t*)(self))
#define TSIP_TRANSAC_GET_TYPE(self) TSIP_TRANSAC(self)->type
#define TSIP_TRANSAC_MAGIC_COOKIE "z9hG4bK"
#define TSIP_TRANSAC_MAGIC_COOKIE "z9hG4bK"
#define TSIP_TRANSAC_SYNC_BEGIN(self) tsk_safeobj_lock(TSIP_TRANSAC(self))
#define TSIP_TRANSAC_SYNC_END(self) tsk_safeobj_unlock(TSIP_TRANSAC(self))
#define TRANSAC_TIMER_SCHEDULE(name, TX) \
self->timer##TX.id = tsk_timer_manager_schedule((tsk_timer_manager_handle_t*)TSIP_TRANSAC(self)->timer_mgr, self->timer##TX.timeout, TSK_TIMER_CALLBACK(tsip_transac_##name##Context_sm_timer##TX), &(self->_fsm))
self->timer##TX.id = tsk_timer_manager_schedule((tsk_timer_manager_handle_t*)TSIP_TRANSAC(self)->timer_mgr, self->timer##TX.timeout, TSK_TIMER_CALLBACK(tsip_transac_##name##_timer_callback), self)
#define TRANSAC_TIMER_CANCEL(TX) \
tsk_timer_manager_cancel((tsk_timer_manager_handle_t*)TSIP_TRANSAC(self)->timer_mgr, self->timer##TX.id)
@ -60,7 +63,8 @@ TSIP_BEGIN_DECLS
typedef enum tsip_transac_event_type_e
{
tsip_transac_msg,
tsip_transac_incoming_msg,
tsip_transac_outgoing_msg,
tsip_transac_canceled,
tsip_transac_terminated,
tsip_transac_timedout,
@ -117,6 +121,8 @@ typedef struct tsip_transac_s
char* callid;
tsip_transac_event_callback callback;
TSK_DECLARE_SAFEOBJ;
}
tsip_transac_t;
@ -127,9 +133,9 @@ typedef tsk_list_t tsip_transacs_L_t; /**< List of @ref tsip_transac_t elements.
================================*/
int tsip_transac_init(tsip_transac_t *self, const tsip_stack_handle_t * stack, tsip_transac_type_t type, unsigned reliable, int32_t cseq_value, const char* cseq_method, const char* callid);
int tsip_transac_deinit(tsip_transac_t *self);
int tsip_transac_send(tsip_transac_t *self, const char *branch, const tsip_message_t *msg);
int tsip_transac_cmp(const tsip_transac_t *t1, const tsip_transac_t *t2);
int tsip_transac_deinit(tsip_transac_t *self);
int tsip_transac_remove_callback(const tsip_transac_t* self, tsk_timer_id_t timer_id);
TSIP_END_DECLS

View File

@ -59,9 +59,12 @@ typedef tsk_list_t tsip_transac_layers_L_t;
TINYSIP_GEXTERN const void *tsip_transac_layer_def_t;
const tsip_transac_t* tsip_transac_layer_new(tsip_transac_layer_t *self, const tsip_message_t* msg);
const tsip_transac_t* tsip_transac_layer_new(const tsip_transac_layer_t *self, int isCT, const tsip_message_t* msg);
int tsip_transac_layer_remove(tsip_transac_layer_t *self, const tsip_transac_t *transac);
const tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t *self, const char* branch, const char* cseq_method);
//const tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t *self, const tsip_response_t* response);
//const tsip_transac_t* tsip_transac_layer_find_server(const tsip_transac_layer_t *self, const tsip_request_t* request);
int tsip_transac_layer_handle_msg(const tsip_transac_layer_t *self, int incoming, const tsip_message_t* message);
TSIP_END_DECLS

View File

@ -40,9 +40,9 @@
TSIP_BEGIN_DECLS
#define TSIP_TRANSAC_NICT_CREATE(stack, reliable, cseq_value, cseq_method, callid) tsk_object_new(tsip_transac_nict_def_t, (const tsip_stack_handle_t *)stack, (unsigned)reliable, (int32_t)cseq_value, (const char*)cseq_method, (const char*)callid)
#define TSIP_TRANSAC_NICT_SAFE_FREE(self) tsk_object_unref(self), self = 0
#define TSIP_TRANSAC_NICT_SAFE_FREE(self) tsk_object_unref(self), self = 0
#define TSIP_TRANSAC_NICT(self) ((tsip_transac_nict_t*)(self))
#define TSIP_TRANSAC_NICT(self) ((tsip_transac_nict_t*)(self))
typedef struct tsip_transac_nict
{

View File

@ -39,27 +39,38 @@
TSIP_BEGIN_DECLS
#define TSIP_TRANSAC_NIST_CREATE(stack, reliable, cseq_value, cseq_method, callid) tsk_object_new(tsip_transac_nist_def_t, (const tsip_stack_handle_t *)stack, (unsigned)reliable, (int32_t)cseq_value, (const char*)cseq_method, (const char*)callid)
#define TSIP_TRANSAC_NIST_SAFE_FREE(self) tsk_object_unref(self), self = 0
#define TSIP_TRANSAC_NIST(self) ((tsip_transac_nist_t*)(self))
typedef struct tsip_transac_nist
{
TSIP_DECLARE_TRANSAC;
struct tsip_transac_nistContext _fsm; /**< The state machine context. */
tsip_response_t* response;
tsip_timer_t timerJ;
}
tsip_transac_nist_t;
void tsip_transac_nist_init(tsip_transac_nist_t *self);
int tsip_transac_nist_start(tsip_transac_nist_t *self);
void tsip_transac_nist_OnTerminated(tsip_transac_nist_t *self);
void tsip_transac_nist_Trying_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_message_t* msg);
void tsip_transac_nist_Trying_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_message_t* msg);
void tsip_transac_nist_Proceeding_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_message_t* msg);
void tsip_transac_nist_Proceeding_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_message_t* msg);
void tsip_transac_nist_Proceeding_2_Proceeding_X_send_response(tsip_transac_nist_t *self, const tsip_message_t* msg);
void tsip_transac_nist_Completed_2_Completed_X_send_response(tsip_transac_nist_t *self, const tsip_message_t* msg);
void tsip_transac_nist_Started_2_Trying_X_recv_request(tsip_transac_nist_t *self, const tsip_request_t* request);
void tsip_transac_nist_Trying_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_request_t* request);
void tsip_transac_nist_Trying_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_request_t* request);
void tsip_transac_nist_Proceeding_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_request_t* request);
void tsip_transac_nist_Proceeding_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_request_t* request);
void tsip_transac_nist_Proceeding_2_Proceeding_X_recv_request(tsip_transac_nist_t *self, const tsip_request_t* request);
void tsip_transac_nist_Completed_2_Completed_X_recv_request(tsip_transac_nist_t *self, const tsip_request_t* request);
void tsip_transac_nist_Completed_2_Terminated_X_tirmerJ(tsip_transac_nist_t *self);
void tsip_transac_nist_Any_2_Terminated_X_transportError(tsip_transac_nist_t *self);
void tsip_transac_nist_OnTerminated(tsip_transac_nist_t *self);
TINYSIP_GEXTERN const void *tsip_transac_nist_def_t;
TSIP_END_DECLS

View File

@ -36,6 +36,7 @@
#include "tinysip/headers/tsip_header_Call_ID.h"
#include "tinysip/headers/tsip_header_Contact.h"
#include "tinysip/headers/tsip_header_Content_Length.h"
#include "tinysip/headers/tsip_header_Content_Type.h"
#include "tinysip/headers/tsip_header_CSeq.h"
#include "tinysip/headers/tsip_header_Expires.h"
#include "tinysip/headers/tsip_header_From.h"
@ -44,6 +45,7 @@
#include "tinysip/headers/tsip_header_Via.h"
#include "tsk_object.h"
#include "tsk_buffer.h"
TSIP_BEGIN_DECLS
@ -70,7 +72,7 @@ TSIP_BEGIN_DECLS
*/
#define TSIP_MESSAGE_CREATE() tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_unknown)
#define TSIP_REQUEST_CREATE(method, uri) tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_request, (const char*)method, (const tsip_uri_t*)uri)
#define TSIP_RESPONSE_CREATE(request, status_code, reason_phrase) tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_response, (const tsip_request_t*)request, (short)status, (const char*)phrase)
#define TSIP_RESPONSE_CREATE(request, status_code, reason_phrase) tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_response, (const tsip_request_t*)request, (short)status_code, (const char*)reason_phrase)
#define TSIP_MESSAGE_SAFE_FREE(self) tsk_object_unref(self), self = 0
#define TSIP_REQUEST_SAFE_FREE(self) TSIP_MESSAGE_SAFE_FREE(self)
#define TSIP_RESPONSE_SAFE_FREE(self) TSIP_MESSAGE_SAFE_FREE(self)
@ -82,8 +84,9 @@ TSIP_BEGIN_DECLS
#define TSIP_REQUEST_METHOD(self) ((self)->line_request.method)
#define TSIP_REQUEST_URI(self) ((self)->line_request.uri)
#define TSIP_MESSAGE_CONTENT_LENGTH(message) (uint32_t)((message && message->Content_Length) ? message->Content_Length->length : 0)
#define TSIP_MESSAGE_CONTENT_LENGTH(message) (uint32_t)(((message) && (message)->Content_Length) ? (message)->Content_Length->length : 0)
#define TSIP_MESSAGE_CONTENT(message) (TSIP_MESSAGE_HAS_CONTENT(message) ? (message)->Content : 0)
#define TSIP_MESSAGE_HAS_CONTENT(message) ((message) && (message)->Content)
/**
* @enum tsip_message_type_t
@ -167,7 +170,10 @@ typedef struct tsip_message_s
tsip_header_Call_ID_t *Call_ID;
tsip_header_CSeq_t *CSeq;
tsip_header_Expires_t *Expires;
tsip_header_Content_Type_t *Content_Type;
tsip_header_Content_Length_t *Content_Length;
tsk_buffer_t *Content;
/*== OTHER HEADERS*/
tsip_headers_L_t *headers;
@ -220,6 +226,7 @@ TINYSIP_API int32_t tsip_message_getCSeq(const tsip_message_t *message);
TINYSIP_API int tsip_message_tostring(const tsip_message_t *self, tsk_buffer_t *output);
TINYSIP_API tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_uri, const tsip_uri_t *from, const tsip_uri_t *to, const char *call_id, int32_t cseq);
TINYSIP_API tsip_response_t *tsip_response_new(short status_code, const char* reason_phrase, const tsip_request_t *request);
TINYSIP_GEXTERN const void *tsip_message_def_t;

View File

@ -2,7 +2,7 @@
# For more information about Ragel: http://www.complang.org/ragel/
#export OPTIONS="-C -L -T0 -F1 -G2"
export OPTIONS="-C -L"
export OPTIONS="-C -L -G2"
# SIP/SIPS/TEL URI parser
#ragel.exe $OPTIONS -o ../source/parsers/tsip_parser_uri.c tsip_parser_uri.rl
@ -15,67 +15,70 @@ ragel.exe $OPTIONS -o ../source/parsers/tsip_parser_header.c tsip_parser_header.
# ==Allow
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl
# ==Allow-Events
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow_Events.c tsip_parser_header_Allow_Events.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow_Events.c tsip_parser_header_Allow_Events.rl
# ==Authorization
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Authorization.c tsip_parser_header_Authorization.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Authorization.c tsip_parser_header_Authorization.rl
# ==Call-ID
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Call_ID.c tsip_parser_header_Call_ID.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Call_ID.c tsip_parser_header_Call_ID.rl
# ==Content-Length
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl
# ==Content-Type
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Content_Type.c tsip_parser_header_Content_Type.rl
# ==Contact
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Contact.c tsip_parser_header_Contact.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Contact.c tsip_parser_header_Contact.rl
# ==CSeq
ragel.exe $OPTIONS -o ../source/headers/tsip_header_CSeq.c tsip_parser_header_CSeq.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_CSeq.c tsip_parser_header_CSeq.rl
# ==Expires
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Expires.c tsip_parser_header_Expires.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Expires.c tsip_parser_header_Expires.rl
# ==From
ragel.exe $OPTIONS -o ../source/headers/tsip_header_From.c tsip_parser_header_From.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_From.c tsip_parser_header_From.rl
# ==Max-Forwards
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Max_Forwards.c tsip_parser_header_Max_Forwards.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Max_Forwards.c tsip_parser_header_Max_Forwards.rl
# ==Min-Expires
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Min_Expires.c tsip_parser_header_Min_Expires.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Min_Expires.c tsip_parser_header_Min_Expires.rl
# ==P-Access-Network-Info
ragel.exe $OPTIONS -o ../source/headers/tsip_header_P_Access_Network_Info.c tsip_parser_header_P_Access_Network_Info.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_P_Access_Network_Info.c tsip_parser_header_P_Access_Network_Info.rl
# ==P-Preferred-Identity
ragel.exe $OPTIONS -o ../source/headers/tsip_header_P_Preferred_Identity.c tsip_parser_header_P_Preferred_Identity.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_P_Preferred_Identity.c tsip_parser_header_P_Preferred_Identity.rl
# ==Privacy
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Privacy.c tsip_parser_header_Privacy.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Privacy.c tsip_parser_header_Privacy.rl
# ==Proxy-Authenticate
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Proxy_Authenticate.c tsip_parser_header_Proxy_Authenticate.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Proxy_Authenticate.c tsip_parser_header_Proxy_Authenticate.rl
# ==Proxy-Authorization
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Proxy_Authorization.c tsip_parser_header_Proxy_Authorization.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Proxy_Authorization.c tsip_parser_header_Proxy_Authorization.rl
# ==Require
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Require.c tsip_parser_header_Require.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Require.c tsip_parser_header_Require.rl
# ==Supported
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Supported.c tsip_parser_header_Supported.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Supported.c tsip_parser_header_Supported.rl
# ==To
ragel.exe $OPTIONS -o ../source/headers/tsip_header_To.c tsip_parser_header_To.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_To.c tsip_parser_header_To.rl
# ==User-Agent
ragel.exe $OPTIONS -o ../source/headers/tsip_header_User_Agent.c tsip_parser_header_User_Agent.rl
# ==Via
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Via.c tsip_parser_header_Via.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Via.c tsip_parser_header_Via.rl
# ==WWW-Authenticate
ragel.exe $OPTIONS -o ../source/headers/tsip_header_WWW_Authenticate.c tsip_parser_header_WWW_Authenticate.rl
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_WWW_Authenticate.c tsip_parser_header_WWW_Authenticate.rl

View File

@ -29,7 +29,8 @@
%%{
machine tsip_machine_message;
message_body = OCTET*;
#message_body = OCTET*;
message_body = any*;
SIP_Version = ("SIP"i "/" DIGIT+ "." DIGIT+) >tag %parse_sipversion;
message_header = any+ >tag :>CRLF %parse_header;
@ -37,16 +38,16 @@
# SIP RESPONSE
Reason_Phrase = (( reserved | unreserved | escaped | UTF8_NONASCII | UTF8_CONT | SP | HTAB )*)>tag %parse_reason_phrase;
Status_Line = SIP_Version :>SP Status_Code>tag %parse_status_code :>SP Reason_Phrase :>CRLF;
Response = Status_Line message_header* CRLF message_body?;
Response = Status_Line (message_header* :>CRLF);
# SIP REQUEST
URI = (scheme HCOLON any+)>tag %parse_requesturi;
Request_URI = URI;
Request_Line = Method>tag %parse_method :>SP Request_URI :>SP SIP_Version :>CRLF;
Request = Request_Line message_header* :>CRLF <:message_body? >tag %parse_body;
Request = Request_Line (message_header* :>CRLF);
# SIP MESSAGE
SIP_message = (Response | Request) @eob;
SIP_message = (Response | Request)>1 @eoh message_body?>0;
}%%

View File

@ -70,6 +70,9 @@
qvalue = ( "0" ( "." DIGIT{,3} )? ) | ( "1" ( "." "0"{,3} )? );
alphanum = ALPHA | DIGIT;
token = ( alphanum | "-" | "." | "!" | "%" | "*" | "_" | "+" | "`" | "'" | "~" )+;
ietf_token = token;
x_token = "x-"i token;
iana_token = token;
token_nodot = ( alphanum | "-" | "!" | "%" | "*" | "_" | "+" | "`" | "'" | "~" )+;
word = ( alphanum | "-" | "." | "!" | "%" | "*" | "_" | "+" | "`" | "'" | "~" | "(" | ")" | "<" | ">" | ":" | "\\" | DQUOTE | "/" | "[" | "]" | "?" | "{" | "}" )+;
domainlabel = alphanum | ( alphanum ( alphanum | "-" )* alphanum );

View File

@ -201,7 +201,10 @@
# /*== Content-Type: ==*/
action parse_header_Content_Type
{
TSK_DEBUG_ERROR("parse_header_Content_Type NOT IMPLEMENTED");
if(!message->Content_Type)
{
message->Content_Type = tsip_header_Content_Type_parse(state->tag_start, (state->tag_end-state->tag_start));
}
}
# /*== CSeq: ==*/

View File

@ -49,7 +49,6 @@
action tag
{
TSK_DEBUG_INFO("ALLOW:TAG");
tag_start = p;
}
@ -60,7 +59,6 @@
action eob
{
TSK_DEBUG_INFO("ALLOW:EOB");
}
Allow = "Allow"i HCOLON ( Method>tag %parse_method ( COMMA Method>tag %parse_method )* )?;

View File

@ -51,7 +51,6 @@
action tag
{
TSK_DEBUG_INFO("ALLOW_EVENTS:TAG");
tag_start = p;
}
@ -62,7 +61,6 @@
action eob
{
TSK_DEBUG_INFO("ALLOW_EVENTS:EOB");
}
event_package = token_nodot;

View File

@ -51,14 +51,12 @@
action tag
{
TSK_DEBUG_INFO("AUTHORIZATION:TAG");
tag_start = p;
}
action is_digest
{
#//FIXME: Only Digest is supported
TSK_DEBUG_INFO("AUTHORIZATION:IS_DIGEST");
hdr_Authorization->scheme = tsk_strdup("Digest");
}
@ -66,67 +64,57 @@
{
PARSER_SET_STRING(hdr_Authorization->username);
tsk_strunquote(&hdr_Authorization->username);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_USERNAME");
}
action parse_realm
{
PARSER_SET_STRING(hdr_Authorization->realm);
tsk_strunquote(&hdr_Authorization->realm);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_REALM");
}
action parse_nonce
{
PARSER_SET_STRING(hdr_Authorization->nonce);
tsk_strunquote(&hdr_Authorization->nonce);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_NONCE");
}
action parse_uri
{
PARSER_SET_STRING(hdr_Authorization->uri);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_URI");
}
action parse_response
{
PARSER_SET_STRING(hdr_Authorization->response);
tsk_strunquote(&hdr_Authorization->response);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_RESPONSE");
}
action parse_algorithm
{
PARSER_SET_STRING(hdr_Authorization->algorithm);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_ALGORITHM");
}
action parse_cnonce
{
PARSER_SET_STRING(hdr_Authorization->cnonce);
tsk_strunquote(&hdr_Authorization->cnonce);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_CNONCE");
}
action parse_opaque
{
PARSER_SET_STRING(hdr_Authorization->opaque);
tsk_strunquote(&hdr_Authorization->opaque);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_OPAQUE");
}
action parse_qop
{
PARSER_SET_STRING(hdr_Authorization->qop);
//tsk_strunquote(&hdr_Authorization->qop);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_QOP");
}
action parse_nc
{
PARSER_SET_STRING(hdr_Authorization->nc);
TSK_DEBUG_INFO("AUTHORIZATION:PARSE_NC");
}
action parse_param
@ -136,10 +124,10 @@
action eob
{
TSK_DEBUG_INFO("AUTHORIZATION:EOB");
}
#FIXME: Only Digest (MD5, AKAv1-MD5 and AKAv2-MD5) is supported
qop_value = "auth" | "auth-int" | token;
other_response = (any+);
auth_param = generic_param>tag %parse_param;
@ -152,7 +140,7 @@
algorithm = "algorithm"i EQUAL <:token>tag %parse_algorithm;
cnonce = "cnonce"i EQUAL quoted_string>tag %parse_cnonce;
opaque = "opaque"i EQUAL quoted_string>tag %parse_opaque;
message_qop = "qop"i EQUAL (any*)>tag %parse_qop;
message_qop = "qop"i EQUAL qop_value>tag %parse_qop;
nonce_count = "nc"i EQUAL (LHEX{8})>tag %parse_nc;
dig_resp = (username | realm | nonce | digest_uri | dresponse | algorithm | cnonce | opaque | message_qop | nonce_count)>1 | auth_param>0;

View File

@ -48,25 +48,21 @@
action tag
{
TSK_DEBUG_INFO("CSEQ:TAG");
tag_start = p;
}
action parse_method
{
PARSER_SET_STRING(hdr_cseq->method);
TSK_DEBUG_INFO("CSEQ:PARSE_METHOD");
}
action parse_seq
{
PARSER_SET_INTEGER(hdr_cseq->seq);
TSK_DEBUG_INFO("CSEQ:PARSE_SEQ");
}
action eob
{
TSK_DEBUG_INFO("CSEQ:EOB");
}
CSeq = "CSeq"i HCOLON DIGIT+>tag %parse_seq LWS Method >tag %parse_method;

View File

@ -51,19 +51,16 @@
action tag
{
TSK_DEBUG_INFO("CALL_ID:TAG");
tag_start = p;
}
action parse_value
{
PARSER_SET_STRING(hdr_call_id->value);
TSK_DEBUG_INFO("CALL_ID:PARSE_VALUE");
}
action eob
{
TSK_DEBUG_INFO("CALL_ID:EOB");
}
callid = word ( "@" word )?;

View File

@ -48,7 +48,6 @@
action tag
{
TSK_DEBUG_INFO("CONTACT:TAG");
tag_start = p;
}
@ -57,7 +56,6 @@
if(!curr_contact)
{
curr_contact = TSIP_HEADER_CONTACT_CREATE();
TSK_DEBUG_INFO("CONTACT:CREATE_CONTACT");
}
}
@ -99,13 +97,11 @@
if(curr_contact)
{
tsk_list_push_back_data(hdr_contacts, ((void**) &curr_contact));
TSK_DEBUG_INFO("CONTACT:ADD_CONTACT");
}
}
action eob
{
TSK_DEBUG_INFO("CONTACT:EOB");
}
URI = (scheme HCOLON any+)>tag %parse_uri;
@ -113,9 +109,9 @@
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
c_p_expires = "expires"i EQUAL delta_seconds>tag %parse_expires;
contact_extension = (generic_param--c_p_expires)>tag %parse_param;
contact_params = c_p_expires | contact_extension;
contact_param = (( my_name_addr | URI ) ( SEMI contact_params )*) >create_contact %add_contact;
contact_extension = (generic_param)>tag %parse_param;
contact_params = c_p_expires>1 | contact_extension>0;
contact_param = (( my_name_addr | URI ) <: ( SEMI contact_params )*) >create_contact %add_contact;
Contact = ( "Contact"i | "m"i ) HCOLON ( STAR | ( contact_param ( COMMA contact_param )* ) );
# Entry point

View File

@ -29,8 +29,6 @@
*/
#include "tinysip/headers/tsip_header_Content_Length.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
@ -48,19 +46,16 @@
action tag
{
TSK_DEBUG_INFO("CONTENT_LENGTH:TAG");
tag_start = p;
}
action parse_content_length
{
PARSER_SET_INTEGER(hdr_clength->length);
TSK_DEBUG_INFO("CONTENT_LENGTH:PARSE_CONTENT_LENGTH");
}
action eob
{
TSK_DEBUG_INFO("CONTENT_LENGTH:EOB");
}
Content_Length = ( "Content-Length"i | "l"i ) HCOLON (DIGIT+)>tag %parse_content_length;
@ -137,6 +132,7 @@ static void* tsip_header_Content_Length_destroy(void *self)
tsip_header_Content_Length_t *Content_Length = self;
if(Content_Length)
{
TSK_LIST_SAFE_FREE(TSIP_HEADER_PARAMS(Content_Length));
}
else TSK_DEBUG_ERROR("Null Content_Length header.");

View File

@ -0,0 +1,170 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Content_Type.c
* @brief SIP Content-Type/c header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Content_Type.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include <string.h>
/**@defgroup tsip_header_Content_Type_group SIP Content_Type header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_Content_Type;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action parse_content_type
{
PARSER_SET_STRING(hdr_ctype->type);
}
action parse_param
{
PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_ctype));
}
action eob
{
}
extension_token = ietf_token | x_token;
m_attribute = token;
m_value = token | quoted_string;
m_parameter = (m_attribute EQUAL m_value)>tag %parse_param;
discrete_type = "text"i | "image"i | "audio"i | "video"i | "application"i | extension_token;
composite_type = "message"i | "multipart"i | extension_token;
m_type = discrete_type | composite_type;
m_subtype = extension_token | iana_token;
media_type = (m_type SLASH m_subtype)>1 >tag %parse_content_type ((SEMI m_parameter)*)>0;
Content_Type = ( "Content-Type"i | "c"i ) HCOLON media_type;
# Entry point
main := Content_Type :>CRLF @eob;
}%%
int tsip_header_Content_Type_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Content_Type_t *Content_Type = header;
return tsk_buffer_append(output, Content_Type->type, strlen(Content_Type->type));
}
return -1;
}
tsip_header_Content_Type_t *tsip_header_Content_Type_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsip_header_Content_Type_t *hdr_ctype = TSIP_HEADER_CONTENT_TYPE_CREATE();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSIP_HEADER_CONTENT_TYPE_SAFE_FREE(hdr_ctype);
}
return hdr_ctype;
}
//========================================================
// Content_Type header object definition
//
/**@ingroup tsip_header_Content_Type_group
*/
static void* tsip_header_Content_Type_create(void *self, va_list * app)
{
tsip_header_Content_Type_t *Content_Type = self;
if(Content_Type)
{
TSIP_HEADER(Content_Type)->type = tsip_htype_Content_Type;
TSIP_HEADER(Content_Type)->tostring = tsip_header_Content_Type_tostring;
}
else
{
TSK_DEBUG_ERROR("Failed to create new Content_Type header.");
}
return self;
}
/**@ingroup tsip_header_Content_Type_group
*/
static void* tsip_header_Content_Type_destroy(void *self)
{
tsip_header_Content_Type_t *Content_Type = self;
if(Content_Type)
{
TSK_FREE(Content_Type->type);
TSK_LIST_SAFE_FREE(TSIP_HEADER_PARAMS(Content_Type));
}
else TSK_DEBUG_ERROR("Null Content_Type header.");
return self;
}
static const tsk_object_def_t tsip_header_Content_Type_def_s =
{
sizeof(tsip_header_Content_Type_t),
tsip_header_Content_Type_create,
tsip_header_Content_Type_destroy,
0
};
const void *tsip_header_Content_Type_def_t = &tsip_header_Content_Type_def_s;

View File

@ -48,7 +48,6 @@
action tag
{
TSK_DEBUG_INFO("FROM:TAG");
tag_start = p;
}
@ -75,7 +74,6 @@
action eob
{
TSK_DEBUG_INFO("FROM:EOB");
}
URI = (scheme HCOLON any+)>tag %parse_uri;

View File

@ -48,19 +48,16 @@
action tag
{
TSK_DEBUG_INFO("MAX_FORWARDS:TAG");
tag_start = p;
}
action parse_value
{
PARSER_SET_INTEGER(hdr_maxf->value);
TSK_DEBUG_INFO("MAX_FORWARDS:PARSE_VALUE");
}
action eob
{
TSK_DEBUG_INFO("MAX_FORWARDS:EOB");
}
Max_Forwards = "Max-Forwards"i HCOLON (DIGIT+)>tag %parse_value;

View File

@ -48,19 +48,16 @@
action tag
{
TSK_DEBUG_INFO("MIN_EXPIRES:TAG");
tag_start = p;
}
action parse_value
{
PARSER_SET_INTEGER(hdr_minE->value);
TSK_DEBUG_INFO("MIN_EXPIRES:PARSE_VALUE");
}
action eob
{
TSK_DEBUG_INFO("MIN_EXPIRES:EOB");
}
Min_Expires = "Min-Expires"i HCOLON (delta_seconds)>tag %parse_value;
@ -141,6 +138,7 @@ static void* tsip_header_Min_Expires_destroy(void *self)
tsip_header_Min_Expires_t *Min_Expires = self;
if(Min_Expires)
{
TSK_LIST_SAFE_FREE(TSIP_HEADER_PARAMS(Min_Expires));
}
else TSK_DEBUG_ERROR("Null Min_Expires header.");

View File

@ -58,7 +58,6 @@
action tag
{
TSK_DEBUG_INFO("P_ACCESS_NETWORK_INFO:TAG");
tag_start = p;
}
@ -69,7 +68,6 @@
action eob
{
TSK_DEBUG_INFO("P_ACCESS_NETWORK_INFO:EOB");
}
P_Access_Network_Info = "P-Access-Network-Info"i HCOLON (any*)>tag %parse_value;

View File

@ -56,7 +56,6 @@
action tag
{
TSK_DEBUG_INFO("P_PREFERRED_IDENTITY:TAG");
tag_start = p;
}
@ -80,7 +79,6 @@
action eob
{
TSK_DEBUG_INFO("P_PREFERRED_IDENTITY:EOB");
}
#/* FIXME: Only one URI is added --> According to the ABNF the header could have more than one URI. */
@ -89,12 +87,11 @@
display_name = (( token LWS )+ | quoted_string)>tag %parse_display_name;
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
PPreferredID_value = my_name_addr | URI;
PPreferredID = "P-Preferred-Identity"i HCOLON PPreferredID_value ( COMMA PPreferredID_value )*;
P_Preferred_Identity = PPreferredID;
PPreferredID_value = (my_name_addr)>0 | (URI)>1;
PPreferredID = "P-Preferred-Identity"i HCOLON PPreferredID_value>1 ( COMMA PPreferredID_value )*>0;
# Entry point
main := P_Preferred_Identity :>CRLF @eob;
main := PPreferredID :>CRLF @eob;
}%%

View File

@ -58,7 +58,6 @@
action tag
{
TSK_DEBUG_INFO("PRIVACY:TAG");
tag_start = p;
}
@ -69,10 +68,9 @@
action eob
{
TSK_DEBUG_INFO("PRIVACY:EOB");
}
priv_value = "header"i | "session"i | "user"i | "none"i | "critical"i | "id"i | "history"i | token;
priv_value = ("header"i | "session"i | "user"i | "none"i | "critical"i | "id"i | "history"i)>1 | token>0;
Privacy_hdr = "Privacy"i HCOLON priv_value>tag %parse_priv_value ( ";" priv_value>tag %parse_priv_value )*;
# Entry point

View File

@ -51,14 +51,12 @@
action tag
{
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:TAG");
tag_start = p;
}
action is_digest
{
#//FIXME: Only Digest is supported
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:IS_DIGEST");
hdr_Proxy_Authenticate->scheme = tsk_strdup("Digest");
}
@ -66,47 +64,40 @@
{
PARSER_SET_STRING(hdr_Proxy_Authenticate->realm);
tsk_strunquote(&hdr_Proxy_Authenticate->realm);
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:PARSE_REALM");
}
action parse_domain
{
PARSER_SET_STRING(hdr_Proxy_Authenticate->domain);
//tsk_strunquote(&hdr_Proxy_Authenticate->domain);
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:PARSE_DOMAIN");
}
action parse_nonce
{
PARSER_SET_STRING(hdr_Proxy_Authenticate->nonce);
tsk_strunquote(&hdr_Proxy_Authenticate->nonce);
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:PARSE_NONCE");
}
action parse_opaque
{
PARSER_SET_STRING(hdr_Proxy_Authenticate->opaque);
tsk_strunquote(&hdr_Proxy_Authenticate->opaque);
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:PARSE_OPAQUE");
}
action parse_stale
{
hdr_Proxy_Authenticate->stale = tsk_strniequals(tag_start, "true", 4);
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:PARSE_STALE");
}
action parse_algorithm
{
PARSER_SET_STRING(hdr_Proxy_Authenticate->algorithm);
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:PARSE_ALGORITHM");
}
action parse_qop
{
PARSER_SET_STRING(hdr_Proxy_Authenticate->qop);
//tsk_strunquote(&hdr_Proxy_Authenticate->qop);
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:PARSE_QOP");
}
action parse_param
@ -116,7 +107,6 @@
action eob
{
TSK_DEBUG_INFO("PROXY_AUTHENTICATE:EOB");
}
#FIXME: Only Digest (MD5, AKAv1-MD5 and AKAv2-MD5) is supported

View File

@ -51,14 +51,12 @@
action tag
{
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:TAG");
tag_start = p;
}
action is_digest
{
#//FIXME: Only Digest is supported
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:IS_DIGEST");
hdr_Proxy_Authorization->scheme = tsk_strdup("Digest");
}
@ -66,61 +64,52 @@
{
PARSER_SET_STRING(hdr_Proxy_Authorization->username);
tsk_strunquote(&hdr_Proxy_Authorization->username);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_USERNAME");
}
action parse_realm
{
PARSER_SET_STRING(hdr_Proxy_Authorization->realm);
tsk_strunquote(&hdr_Proxy_Authorization->realm);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_REALM");
}
action parse_nonce
{
PARSER_SET_STRING(hdr_Proxy_Authorization->nonce);
tsk_strunquote(&hdr_Proxy_Authorization->nonce);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_NONCE");
}
action parse_uri
{
PARSER_SET_STRING(hdr_Proxy_Authorization->uri);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_URI");
}
action parse_response
{
PARSER_SET_STRING(hdr_Proxy_Authorization->response);
tsk_strunquote(&hdr_Proxy_Authorization->response);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_RESPONSE");
}
action parse_algorithm
{
PARSER_SET_STRING(hdr_Proxy_Authorization->algorithm);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_ALGORITHM");
}
action parse_cnonce
{
PARSER_SET_STRING(hdr_Proxy_Authorization->cnonce);
tsk_strunquote(&hdr_Proxy_Authorization->cnonce);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_CNONCE");
}
action parse_opaque
{
PARSER_SET_STRING(hdr_Proxy_Authorization->opaque);
tsk_strunquote(&hdr_Proxy_Authorization->opaque);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_OPAQUE");
}
action parse_qop
{
PARSER_SET_STRING(hdr_Proxy_Authorization->qop);
//tsk_strunquote(&hdr_Proxy_Authorization->qop);
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:PARSE_QOP");
}
action parse_nc
@ -136,10 +125,10 @@
action eob
{
TSK_DEBUG_INFO("PROXY_AUTHORIZATION:EOB");
}
#FIXME: Only Digest (MD5, AKAv1-MD5 and AKAv2-MD5) is supported
qop_value = "auth" | "auth-int" | token;
other_response = (any+);
auth_param = generic_param>tag %parse_param;
@ -152,7 +141,7 @@
algorithm = "algorithm"i EQUAL <:token>tag %parse_algorithm;
cnonce = "cnonce"i EQUAL quoted_string>tag %parse_cnonce;
opaque = "opaque"i EQUAL quoted_string>tag %parse_opaque;
message_qop = "qop"i EQUAL (any*)>tag %parse_qop;
message_qop = "qop"i EQUAL qop_value>tag %parse_qop;
nonce_count = "nc"i EQUAL (LHEX{8})>tag %parse_nc;
dig_resp = (username | realm | nonce | digest_uri | dresponse | algorithm | cnonce | opaque | message_qop | nonce_count)>1 | auth_param>0;

View File

@ -50,7 +50,6 @@
action tag
{
TSK_DEBUG_INFO("REQUIRE:TAG");
tag_start = p;
}
@ -61,7 +60,6 @@
action eob
{
TSK_DEBUG_INFO("REQUIRE:EOB");
}
Require = "Require"i HCOLON option_tag>tag %parse_option ( COMMA option_tag>tag %parse_option )*;

View File

@ -50,7 +50,6 @@
action tag
{
TSK_DEBUG_INFO("SUPPORTED:TAG");
tag_start = p;
}
@ -61,7 +60,6 @@
action eob
{
TSK_DEBUG_INFO("SUPPORTED:EOB");
}
Supported = ( "Supported"i | "k"i ) HCOLON ( option_tag>tag %parse_option ( COMMA option_tag>tag %parse_option )* )?;

View File

@ -48,7 +48,6 @@
action tag
{
TSK_DEBUG_INFO("TO:TAG");
tag_start = p;
}
@ -56,30 +55,25 @@
{
int len = (int)(p - tag_start);
hdr_to->uri = tsip_uri_parse(tag_start, (size_t)len);
TSK_DEBUG_INFO("TO:PARSE_URI");
}
action parse_display_name
{
PARSER_SET_STRING(hdr_to->display_name);
TSK_DEBUG_INFO("TO:PARSE_DISPLAY_NAME");
}
action parse_tag
{
PARSER_SET_STRING(hdr_to->tag);
TSK_DEBUG_INFO("TO:PARSE_TAG");
}
action parse_param
{
PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_to));
TSK_DEBUG_INFO("TO:PARSE_PARAM");
}
action eob
{
TSK_DEBUG_INFO("TO:EOB");
}
my_tag_param = "tag"i EQUAL token>tag %parse_tag;

View File

@ -50,19 +50,16 @@
action tag
{
TSK_DEBUG_INFO("USER_AGENT:TAG");
tag_start = p;
}
action parse_user_agent
{
PARSER_SET_STRING(hdr_user_agent->value);
TSK_DEBUG_INFO("USER_AGENT:parse_user_agent");
}
action eob
{
TSK_DEBUG_INFO("USER_AGENT:EOB");
}
User_Agent = "User-Agent"i HCOLON (any*)>tag %parse_user_agent;

View File

@ -47,7 +47,6 @@
action tag
{
TSK_DEBUG_INFO("VIA:TAG");
tag_start = p;
}
@ -109,7 +108,6 @@
action parse_param
{
PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_via));
TSK_DEBUG_INFO("VIA:PARSE_PARAM");
}
action eob
@ -128,8 +126,8 @@
via_branch = "branch"i EQUAL token >tag %parse_branch;
via_compression = "comp"i EQUAL ( "sigcomp"i | other_compression )>tag %parse_comp;
response_port = "rport"i ( EQUAL DIGIT+ >tag %parse_rport )?;
via_extension = (generic_param & !(via_ttl | via_maddr | via_received | via_branch | via_compression | response_port)) >tag %parse_param;
via_params = via_ttl | via_maddr | via_received | via_branch | via_compression | response_port | via_extension;
via_extension = (generic_param) >tag %parse_param;
via_params = (via_ttl | via_maddr | via_received | via_branch | via_compression | response_port)>1 | (via_extension)>0;
via_parm = sent_protocol LWS sent_by ( SEMI via_params )*;
Via = ( "Via"i | "v"i ) HCOLON via_parm ( COMMA via_parm )*;

View File

@ -51,14 +51,12 @@
action tag
{
TSK_DEBUG_INFO("WWW_AUTHENTICATE:TAG");
tag_start = p;
}
action is_digest
{
#//FIXME: Only Digest is supported
TSK_DEBUG_INFO("WWW_AUTHENTICATE:IS_DIGEST");
hdr_WWW_Authenticate->scheme = tsk_strdup("Digest");
}
@ -66,58 +64,49 @@
{
PARSER_SET_STRING(hdr_WWW_Authenticate->realm);
tsk_strunquote(&hdr_WWW_Authenticate->realm);
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_REALM");
}
action parse_domain
{
PARSER_SET_STRING(hdr_WWW_Authenticate->domain);
//tsk_strunquote(&hdr_WWW_Authenticate->domain);
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_DOMAIN");
}
action parse_nonce
{
PARSER_SET_STRING(hdr_WWW_Authenticate->nonce);
tsk_strunquote(&hdr_WWW_Authenticate->nonce);
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_NONCE");
}
action parse_opaque
{
PARSER_SET_STRING(hdr_WWW_Authenticate->opaque);
tsk_strunquote(&hdr_WWW_Authenticate->opaque);
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_OPAQUE");
}
action parse_stale
{
hdr_WWW_Authenticate->stale = tsk_strniequals(tag_start, "true", 4);
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_STALE");
}
action parse_algorithm
{
PARSER_SET_STRING(hdr_WWW_Authenticate->algorithm);
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_ALGORITHM");
}
action parse_qop
{
PARSER_SET_STRING(hdr_WWW_Authenticate->qop);
//tsk_strunquote(&hdr_WWW_Authenticate->qop);
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_QOP");
}
action parse_param
{
PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_WWW_Authenticate));
TSK_DEBUG_INFO("WWW_AUTHENTICATE:PARSE_PARAM");
}
action eob
{
TSK_DEBUG_INFO("WWW_AUTHENTICATE:EOB");
}
#FIXME: Only Digest (MD5, AKAv1-MD5 and AKAv2-MD5) is supported

View File

@ -37,7 +37,7 @@
static void tsip_message_parser_execute(tsip_ragel_state_t *state, tsip_message_t *message);
static void tsip_message_parser_init(tsip_ragel_state_t *state);
static void tsip_message_parser_eob(tsip_ragel_state_t *state);
static void tsip_message_parser_eoh(tsip_ragel_state_t *state, tsip_message_t *message);
/***********************************
* Ragel state machine.
@ -49,7 +49,6 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
action tag
{
state->tag_start = p;
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::TAG state=%d", state->cs);
}
#/* SIP method */
@ -72,8 +71,6 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
{
state->cs = tsip_machine_parser_message_error;
}
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_METHOD len=%d state=%d", len, state->cs);
}
#/* Request URI parsing */
@ -87,8 +84,6 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
{
message->line_request.uri = tsip_uri_parse(state->tag_start, (size_t)len);
}
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_REQUESTURI len=%d state=%d", len, state->cs);
}
#/* Sip Version */
@ -103,8 +98,6 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
message->sip_version = tsk_calloc(1, len+1);
memcpy(message->sip_version, state->tag_start, len);
}
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_SIPVERSION len=%d state=%d", len, state->cs);
}
#/* Status Code */
@ -123,8 +116,6 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
{
state->cs = tsip_machine_parser_message_error;
}
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_STATUS_CODE len=%d state=%d", len, state->cs);
}
#/* Reason Phrase */
@ -139,8 +130,6 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
message->line_status.reason_phrase = tsk_calloc(1, len+1);
memcpy(message->line_status.reason_phrase, state->tag_start, len);
}
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_REASON_PHRASE len=%d state=%d", len, state->cs);
}
#/* Parse sip header */
@ -152,7 +141,7 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
if(tsip_header_parse(state, message))
{
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_HEADER len=%d state=%d", len, state->cs);
//TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_HEADER len=%d state=%d", len, state->cs);
}
else
{
@ -161,19 +150,28 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
}
#/* Parse sip content/body. */
action parse_body
{
int len;
state->tag_end = p;
len = (int)(state->tag_end - state->tag_start);
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::PARSE_BODY len=%d state=%d", len, state->cs);
}
#action parse_body
#{
# int len;
# state->tag_end = p;
# len = (int)(state->tag_end - state->tag_start);
# TSK_DEBUG_ERROR("==TSIP_MESSAGE_PARSER::PARSE_BODY==");
#}
#/* End-Of-the-Buffer */
action eob
#/* End-Of-Headers */
action eoh
{
tsip_message_parser_eob(state);
TSK_DEBUG_INFO("TSIP_MESSAGE_PARSER::EOB state=%d", state->cs);
state->cs = cs;
state->p = p;
state->pe = pe;
state->eof = eof;
tsip_message_parser_eoh(state, message);
cs = state->cs;
p = state->p;
pe = state->pe;
eof = state->eof;
}
# Includes
@ -203,26 +201,31 @@ static void tsip_message_parser_eob(tsip_ragel_state_t *state);
/// @return @ref TSIP_TRUE if succeed and @ref TSIP_FALSE otherwise.
///
////////////////////////////////////////////////////////////////////////////////////////////////////
TSIP_BOOLEAN tsip_message_parse(tsip_ragel_state_t *state, tsip_message_t *result)
TSIP_BOOLEAN tsip_message_parse(tsip_ragel_state_t *state, tsip_message_t **result)
{
if(!state || state->pe <= state->p)
{
return TSIP_FALSE;
}
if(!*result)
{
*result = TSIP_MESSAGE_CREATE();
}
/* Ragel init */
tsip_message_parser_init(state);
/*
* State mechine execution.
*/
tsip_message_parser_execute(state, result);
tsip_message_parser_execute(state, *result);
/* Check result */
if( state->cs < %%{ write first_final; }%% )
{
TSIP_MESSAGE_SAFE_FREE(result);
TSIP_MESSAGE_SAFE_FREE(*result);
return TSIP_FALSE;
}
return TSIP_TRUE;
@ -254,12 +257,30 @@ static void tsip_message_parser_execute(tsip_ragel_state_t *state, tsip_message_
state->eof = eof;
}
static void tsip_message_parser_eob(tsip_ragel_state_t *state)
static void tsip_message_parser_eoh(tsip_ragel_state_t *state, tsip_message_t *message)
{
int cs = state->cs;
//const char *eof = state->eof;
const char *p = state->p;
const char *pe = state->pe;
const char *eof = state->eof;
if(message)
{
uint32_t clen = tsip_message_getContent_length(message);
if((p+clen) <pe && !message->Content)
{
message->Content = TSK_BUFFER_CREATE((p+1), clen);
p = (p+clen);
}
else
{
p = (pe-1);
}
}
//%%write eof;
state->cs = cs;
state->p = p;
state->pe = pe;
state->eof = eof;
}

View File

@ -47,7 +47,6 @@
action tag
{
TSK_DEBUG_INFO("URI:TAG");
tag_start = p;
}
@ -64,42 +63,35 @@
action parse_scheme
{
PARSER_SET_STRING(uri->scheme);
TSK_DEBUG_INFO("URI:SCHEME");
}
action parse_user_name
{
PARSER_SET_STRING(uri->user_name);
TSK_DEBUG_INFO("URI:USER_NAME");
}
action parse_password
{
PARSER_SET_STRING(uri->password);
TSK_DEBUG_INFO("URI:PARSE_PASSWORD");
}
action parse_host
{
PARSER_SET_STRING(uri->host);
TSK_DEBUG_INFO("URI:PARSE_HOST");
}
action parse_port
{
PARSER_SET_INTEGER(uri->port);
TSK_DEBUG_INFO("URI:PARSE_PORT");
}
action parse_param
{
PARSER_ADD_PARAM(uri->params);
TSK_DEBUG_INFO("URI:PARSE_PARAM");
}
action eob
{
TSK_DEBUG_INFO("URI:EOB");
}
#uri_parameter = transport_param | user_param | method_param | ttl_param | maddr_param | lr_param | compression_param | target_param | cause_param | orig | gr_param | other_param;
@ -111,11 +103,11 @@
my_userinfo = ( user>tag %parse_user_name | telephone_subscriber ) :> ( ":" password>tag %parse_password )? "@";
UNKNOWN_URI = (scheme & !("sip"i | "sips"i | "tel"i))>tag %parse_scheme HCOLON <:any*;
UNKNOWN_URI = (scheme)>tag %parse_scheme HCOLON <:any*;
SIP_URI = ("sip:"i %is_sip | "sips:"i %is_sips) my_userinfo? my_hostport uri_parameters headers?;
TEL_URI = ("tel:"i >is_tel) telephone_subscriber;
URI = (SIP_URI | TEL_URI | UNKNOWN_URI);
URI = ((SIP_URI)>1 | (TEL_URI)>1 | (UNKNOWN_URI)>0);
# Entry point
main := URI;

View File

@ -0,0 +1,145 @@
%{
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_message.sm.
* @brief SIP dialog MESSAGE.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
%}
%class tsip_dialog_message
%header "tinysip/dialogs/tsip_dialog_message.h"
%header "tinysip/tsip_message.h"
%start tsip_dialog_message::Started
%include "tsk_debug.h"
%map tsip_dialog_message
%%
//------------------------
//------------------------
Started
{
sm_send(msg: const tsip_message_t*)
Sending
{
Started_2_Sending_X_send(msg);
}
sm_receive(msg: const tsip_message_t*)
Receiving
{
Started_2_Receiving_X_recv(msg);
}
}
//------------------------
//------------------------
Sending
{
sm_1xx(msg: const tsip_message_t*)
nil
{
Sending_2_Sending_X_1xx(msg);
}
sm_2xx(msg: const tsip_message_t*)
Terminated
{
Sending_2_Terminated_X_2xx(msg);
}
sm_401_407_421_494(msg: const tsip_message_t*)
nil
{
Sending_2_Sending_X_401_407_421_494(msg);
}
sm_300_to_699(msg: const tsip_message_t*)
Terminated
{
Sending_2_Terminated_X_300_to_699(msg);
}
sm_cancel()
Terminated
{
Sending_2_Terminated_X_cancel();
}
}
//------------------------
//------------------------
Receiving
{
sm_accept(msg: const tsip_message_t*)
Terminated
{
Receiving_2_Terminated_X_accept(msg);
}
sm_reject(msg: const tsip_message_t*)
Terminated
{
Receiving_2_Terminated_X_reject(msg);
}
}
//------------------------
//------------------------
Terminated
Entry
{
OnTerminated();
}
{
Default
nil
{
}
}
//------------------------
//------------------------
Default
{
sm_transportError()
Terminated
{
Any_2_Terminated_X_transportError();
}
sm_error()
Terminated
{
}
Default
nil
{
}
}
%%

View File

@ -61,13 +61,13 @@ Trying
{
}
{
sm_timerE(timer_id: tsk_timer_id_t)
sm_timerE()
nil
{
Trying_2_Trying_X_timerE();
}
sm_timerF(timer_id: tsk_timer_id_t)
sm_timerF()
Terminated
{
Trying_2_Terminated_X_timerF();
@ -99,13 +99,13 @@ Proceeding
{
}
{
sm_timerE(timer_id: tsk_timer_id_t)
sm_timerE()
nil
{
Proceeding_2_Proceeding_X_timerE();
}
sm_timerF(timer_id: tsk_timer_id_t)
sm_timerF()
Terminated
{
Proceeding_2_Terminated_X_timerF();
@ -137,7 +137,7 @@ Completed
{
}
{
sm_timerK(timer_id: tsk_timer_id_t)
sm_timerK()
Terminated
{
Completed_2_Terminated_X_timerK();

View File

@ -33,11 +33,27 @@
%class tsip_transac_nist
%header "tinysip/transactions/tsip_transac_nist.h"
%header "tinysip/tsip_message.h"
%start tsip_transac_nist::Trying
%start tsip_transac_nist::Started
%map tsip_transac_nist
%%
//------------------------
//------------------------
Started
Entry
{
}
{
sm_recv_request(request: const tsip_request_t*)
Trying
{
Started_2_Trying_X_recv_request(request);
}
}
//------------------------
//------------------------
Trying
@ -46,16 +62,16 @@ Trying
}
{
sm_send_1xx(msg: const tsip_message_t*)
sm_send_1xx(request: const tsip_request_t*)
Proceeding
{
Trying_2_Proceeding_X_send_1xx(msg);
Trying_2_Proceeding_X_send_1xx(request);
}
sm_send_200_to_699(msg: const tsip_message_t*)
sm_send_200_to_699(request: const tsip_request_t*)
Completed
{
Trying_2_Completed_X_send_200_to_699(msg);
Trying_2_Completed_X_send_200_to_699(request);
}
}
@ -67,22 +83,22 @@ Proceeding
{
}
{
sm_send_1xx(msg: const tsip_message_t*)
sm_send_1xx(request: const tsip_request_t*)
nil
{
Proceeding_2_Proceeding_X_send_1xx(msg);
Proceeding_2_Proceeding_X_send_1xx(request);
}
sm_send_200_to_699(msg: const tsip_message_t*)
sm_send_200_to_699(request: const tsip_request_t*)
Completed
{
Proceeding_2_Completed_X_send_200_to_699(msg);
Proceeding_2_Completed_X_send_200_to_699(request);
}
sm_send_response(msg: const tsip_message_t*)
sm_recv_request(request: const tsip_request_t*)
nil
{
Proceeding_2_Proceeding_X_send_response(msg);
Proceeding_2_Proceeding_X_recv_request(request);
}
}
@ -94,10 +110,10 @@ Completed
{
}
{
sm_send_response(msg: const tsip_message_t*)
sm_recv_request(request: const tsip_request_t*)
nil
{
Completed_2_Completed_X_send_response(msg);
Completed_2_Completed_X_recv_request(request);
}
sm_timerJ()

View File

@ -243,7 +243,7 @@ int tsip_dialog_request_send(const tsip_dialog_t *self, tsip_request_t* request)
As this is an outgoing request ==> It shall be a client transaction (NICT or ICT).
For server transactions creation see @ref tsip_dialog_response_send.
*/
const tsip_transac_t *transac = tsip_transac_layer_new(layer, request);
const tsip_transac_t *transac = tsip_transac_layer_new(layer, 1, request);
/* Set the transaction's dialog. All events comming from the transaction (timeouts, errors ...) will be signaled to this dialog.
*/
@ -278,13 +278,28 @@ int tsip_dialog_request_send(const tsip_dialog_t *self, tsip_request_t* request)
return -1;
}
tsip_response_t *tsip_dialog_response_new(const tsip_dialog_t *self, short status, const char* phrase, const tsip_request_t* request)
{
/* Reponse is created as per RFC 3261 subclause 8.2.6 and (headers+tags) are copied
* as per subclause 8.2.6.2.
*/
tsip_response_t* response = tsip_response_new(status, phrase, request);
return response;
}
int tsip_dialog_response_send(const tsip_dialog_t *self, tsip_response_t* response)
{
int ret = -1;
if(self && self->stack)
{
return 0;
tsip_transac_layer_t *layer = tsip_stack_get_transac_layer(self->stack);
if(layer)
{
ret = tsip_transac_layer_handle_msg(layer, 0, response);
}
}
return -1;
return ret;
}
/**

View File

@ -30,6 +30,9 @@
#include "tinysip/dialogs/tsip_dialog_layer.h"
#include "tinysip/dialogs/tsip_dialog_register.h"
#include "tinysip/dialogs/tsip_dialog_message.h"
#include "tinysip/transactions/tsip_transac_layer.h"
/**
@ -61,6 +64,31 @@ static tsip_dialog_t* tsip_dialog_layer_find_dialog(tsip_dialog_layer_t *self, t
return 0;
}
const tsip_dialog_t* tsip_dialog_layer_find(const tsip_dialog_layer_t *self, const char* callid, const char* to_tag, const char* from_tag)
{
tsip_dialog_t *ret = 0;
tsip_dialog_t *dialog;
tsk_list_item_t *item;
tsk_safeobj_lock(self);
tsk_list_foreach(item, self->dialogs)
{
dialog = item->data;
if( tsk_strequals(dialog->callid, callid)
&& tsk_strequals(dialog->tag_local, to_tag)
&& tsk_strequals(dialog->tag_remote, from_tag)
)
{
ret = dialog;
break;
}
}
tsk_safeobj_unlock(self);
return ret;
}
/**
* @fn int tsip_dialog_layer_register(tsip_dialog_layer_t *self,
@ -82,6 +110,8 @@ int tsip_dialog_layer_register(tsip_dialog_layer_t *self, const tsip_operation_h
if(self)
{
//tsk_safeobj_lock(self);
tsip_dialog_register_t *dialog = (tsip_dialog_register_t*)tsip_dialog_layer_find_dialog(self, tsip_dialog_register, operation);
if(dialog)
{
@ -93,12 +123,51 @@ int tsip_dialog_layer_register(tsip_dialog_layer_t *self, const tsip_operation_h
ret = tsip_dialog_register_start(dialog);
tsk_list_push_back_data(self->dialogs, (void**)&dialog);
}
//tsk_safeobj_unlock(self);
}
return ret;
}
int tsip_dialog_layer_handle_msg(const tsip_dialog_layer_t *self, const tsip_message_t* message)
{
int ret = -1;
const tsip_dialog_t* dialog;
tsk_safeobj_lock(self);
dialog = tsip_dialog_layer_find(self, message->Call_ID->value, message->To->tag, message->From->tag);
if(dialog)
{
dialog->callback(dialog, tsip_dialog_msg, message);
}
else
{
const tsip_transac_layer_t *layer_transac = tsip_stack_get_transac_layer(self->stack);
const tsip_transac_t* transac;
if(TSIP_MESSAGE_IS_REQUEST(message))
{
if(tsk_strequals("MESSAGE", TSIP_REQUEST_METHOD(message)))
{
tsip_dialog_message_t *dlg_msg = TSIP_DIALOG_MESSAGE_CREATE(self->stack, 0);
transac = tsip_transac_layer_new(layer_transac, 0, message);
if(transac)
{
TSIP_TRANSAC(transac)->dialog = TSIP_DIALOG(dlg_msg);
//ret = tsip_dialog_message_recv(dlg_msg, message);
}
tsk_list_push_back_data(self->dialogs, (void**)&dlg_msg);
}
}
}
tsk_safeobj_unlock(self);
return ret;
}
@ -114,6 +183,8 @@ static void* tsip_dialog_layer_create(void * self, va_list * app)
{
layer->stack = va_arg(*app, const tsip_stack_handle_t *);
layer->dialogs = TSK_LIST_CREATE();
tsk_safeobj_init(layer);
}
return self;
}
@ -124,6 +195,8 @@ static void* tsip_dialog_layer_destroy(void * self)
if(layer)
{
TSK_LIST_SAFE_FREE(layer->dialogs);
tsk_safeobj_deinit(layer);
}
return self;
}

View File

@ -0,0 +1,284 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_message.client.c
* @brief SIP dialog message (Client side).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/dialogs/tsip_dialog_message.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tinysip/headers/tsip_header_Min_Expires.h"
#include "tsk_memory.h"
#include "tsk_debug.h"
#include "tsk_time.h"
#define DEBUG_STATE_MACHINE 1
#define TSIP_DIALOG_MESSAGE_SIGNAL_ERROR(self) \
TSIP_DIALOG_SYNC_BEGIN(self); \
tsip_dialog_messageContext_sm_error(&TSIP_DIALOG_MESSAGE(self)->_fsm); \
TSIP_DIALOG_SYNC_END(self);
int send_message(tsip_dialog_message_t *self);
int send_response(tsip_dialog_message_t *self, short status, const char* phrase, const tsip_request_t *request);
int tsip_dialog_message_event_callback(const tsip_dialog_message_t *self, tsip_dialog_event_type_t type, const tsip_message_t *msg)
{
TSIP_DIALOG_SYNC_BEGIN(self);
switch(type)
{
case tsip_dialog_msg:
{
if(msg)
{
if(TSIP_MESSAGE_IS_RESPONSE(msg))
{
short status_code = TSIP_RESPONSE_CODE(msg);
if(status_code <=199)
{
tsip_dialog_messageContext_sm_1xx(&TSIP_DIALOG_MESSAGE(self)->_fsm, msg);
}
else if(status_code<=299)
{
tsip_dialog_messageContext_sm_2xx(&TSIP_DIALOG_MESSAGE(self)->_fsm, msg);
}
else if(status_code == 401 || status_code == 407 || status_code == 421 || status_code == 494)
{
tsip_dialog_messageContext_sm_401_407_421_494(&TSIP_DIALOG_MESSAGE(self)->_fsm, msg);
}
else
{
// Alert User
TSIP_DIALOG_MESSAGE_SIGNAL_ERROR(self);
TSK_DEBUG_WARN("Not supported status code: %d", status_code);
}
}
else
{
tsip_dialog_messageContext_sm_receive(&TSIP_DIALOG_MESSAGE(self)->_fsm, msg);
}
}
break;
}
case tsip_dialog_canceled:
{
tsip_dialog_messageContext_sm_cancel(&TSIP_DIALOG_MESSAGE(self)->_fsm);
break;
}
case tsip_dialog_terminated:
case tsip_dialog_timedout:
case tsip_dialog_error:
case tsip_dialog_transport_error:
{
tsip_dialog_messageContext_sm_transportError(&TSIP_DIALOG_MESSAGE(self)->_fsm);
break;
}
}
TSIP_DIALOG_SYNC_END(self);
return 0;
}
void tsip_dialog_message_init(tsip_dialog_message_t *self)
{
/* Initialize the state machine.
*/
tsip_dialog_messageContext_Init(&self->_fsm, self);
TSIP_DIALOG(self)->callback = tsip_dialog_message_event_callback;
#if defined(_DEBUG) || defined(DEBUG)
setDebugFlag(&(self->_fsm), DEBUG_STATE_MACHINE);
#endif
}
/*int tsip_dialog_message_send(tsip_dialog_message_t *self)
{
int ret = -1;
self->sender = 1;
//tsip_dialog_messageContext_sm_send(&self->_fsm, message);
return ret;
}
int tsip_dialog_message_recv(tsip_dialog_message_t *self, const tsip_message_t *message)
{
int ret = -1;
self->sender = 0;
tsip_dialog_messageContext_sm_receive(&self->_fsm, message);
return ret;
}*/
int send_response(tsip_dialog_message_t *self, short status, const char* phrase, const tsip_request_t *request)
{
tsip_response_t *response;
int ret = -1;
response = tsip_dialog_response_new(TSIP_DIALOG(self), status, phrase, request);
if(response)
{
ret = tsip_dialog_response_send(TSIP_DIALOG(self), response);
TSIP_RESPONSE_SAFE_FREE(response);
}
return ret;
}
//--------------------------------------------------------
// == STATE MACHINE BEGIN ==
//--------------------------------------------------------
void tsip_dialog_message_Started_2_Sending_X_send(tsip_dialog_message_t *self, const tsip_message_t *message)
{
}
void tsip_dialog_message_Started_2_Receiving_X_recv(tsip_dialog_message_t *self, const tsip_message_t *message)
{
send_response(self, 200, "OK", message);
}
void tsip_dialog_message_Sending_2_Sending_X_1xx(tsip_dialog_message_t *self, const tsip_message_t *message)
{
}
void tsip_dialog_message_Sending_2_Terminated_X_2xx(tsip_dialog_message_t *self, const tsip_message_t *message)
{
}
void tsip_dialog_message_Sending_2_Sending_X_401_407_421_494(tsip_dialog_message_t *self, const tsip_message_t *message)
{
}
void tsip_dialog_message_Sending_2_Terminated_X_300_to_699(tsip_dialog_message_t *self, const tsip_message_t *message)
{
}
void tsip_dialog_message_Sending_2_Terminated_X_cancel(tsip_dialog_message_t *self)
{
}
void tsip_dialog_message_Receiving_2_Terminated_X_accept(tsip_dialog_message_t *self, const tsip_message_t *message)
{
}
void tsip_dialog_message_Receiving_2_Terminated_X_reject(tsip_dialog_message_t *self, const tsip_message_t *message)
{
}
void tsip_dialog_message_Any_2_Terminated_X_transportError(tsip_dialog_message_t *self)
{
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// == STATE MACHINE END ==
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void tsip_dialog_message_OnTerminated(tsip_dialog_message_t *self)
{
}
//========================================================
// SIP dialog MESSAGE object definition
//
static void* tsip_dialog_message_create(void * self, va_list * app)
{
tsip_dialog_message_t *dialog = self;
if(dialog)
{
const tsip_stack_handle_t *stack = va_arg(*app, const tsip_stack_handle_t *);
const tsip_operation_handle_t *operation = va_arg(*app, const tsip_operation_handle_t *);
/* Initialize base class */
tsip_dialog_init(TSIP_DIALOG(self), tsip_dialog_message, stack, 0, operation);
/* Initialize the class itself */
tsip_dialog_message_init(self);
}
return self;
}
static void* tsip_dialog_message_destroy(void * self)
{
tsip_dialog_message_t *dialog = self;
if(dialog)
{
/* DeInitialize base class */
tsip_dialog_deinit(TSIP_DIALOG(self));
}
return self;
}
static int tsip_dialog_message_cmp(const void *obj1, const void *obj2)
{
return -1;
}
static const tsk_object_def_t tsip_dialog_message_def_s =
{
sizeof(tsip_dialog_message_t),
tsip_dialog_message_create,
tsip_dialog_message_destroy,
tsip_dialog_message_cmp,
};
const void *tsip_dialog_message_def_t = &tsip_dialog_message_def_s;

View File

@ -46,7 +46,7 @@
int send_register(tsip_dialog_register_t *self);
/**
* @fn int tsip_dialog_register_event_callback(const void *arg, tsip_dialog_event_type_t type,
* @fn int tsip_dialog_register_event_callback(const tsip_dialog_register_t *self, tsip_dialog_event_type_t type,
* const tsip_message_t *msg)
*
* @brief Callback function called to alert the dialog for new events from the transaction/transport layers.
@ -54,16 +54,14 @@ int send_register(tsip_dialog_register_t *self);
* @author Mamadou
* @date 1/4/2010
*
* @param [in,out] arg Opaque data. Shall contain a reference to the dialog itself.
* @param [in,out] self A reference to the dialog.
* @param type The event type.
* @param [in,out] msg The incoming SIP/IMS message.
*
* @return Zero if succeed and non-zero error code otherwise.
**/
int tsip_dialog_register_event_callback(const void *arg, tsip_dialog_event_type_t type, const tsip_message_t *msg)
int tsip_dialog_register_event_callback(const tsip_dialog_register_t *self, tsip_dialog_event_type_t type, const tsip_message_t *msg)
{
const tsip_dialog_register_t *self = arg;
TSIP_DIALOG_SYNC_BEGIN(self);
switch(type)
@ -350,7 +348,7 @@ void tsip_dialog_register_Any_2_Terminated_X_transportError(tsip_dialog_register
int send_register(tsip_dialog_register_t *self)
{
tsip_request_t *request;
int ret;
int ret = -1;
request = tsip_dialog_request_new(TSIP_DIALOG(self), "REGISTER");
ret = tsip_dialog_request_send(TSIP_DIALOG(self), request);

View File

@ -44,7 +44,7 @@
* Ragel state machine.
*/
/* #line 71 "tsip_parser_header_Allow.rl" */
/* #line 69 "tsip_parser_header_Allow.rl" */
int tsip_header_Allow_tostring(const void* header, tsk_buffer_t* output)
@ -87,76 +87,6 @@ tsip_header_Allow_t *tsip_header_Allow_parse(const char *data, size_t size)
/* #line 90 "../source/headers/tsip_header_Allow.c" */
static const char _tsip_machine_parser_header_Allow_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Allow_key_offsets[] = {
0, 0, 2, 4, 6, 8, 10, 13,
30, 31, 47, 51, 52, 54, 57, 74,
75, 77, 93
};
static const char _tsip_machine_parser_header_Allow_trans_keys[] = {
65, 97, 76, 108, 76, 108, 79, 111,
87, 119, 9, 32, 58, 9, 13, 32,
33, 37, 39, 126, 42, 43, 45, 46,
48, 57, 65, 90, 95, 122, 10, 9,
13, 32, 33, 37, 39, 44, 126, 42,
46, 48, 57, 65, 90, 95, 122, 9,
13, 32, 44, 10, 9, 32, 9, 32,
44, 9, 13, 32, 33, 37, 39, 126,
42, 43, 45, 46, 48, 57, 65, 90,
95, 122, 10, 9, 32, 9, 32, 33,
37, 39, 126, 42, 43, 45, 46, 48,
57, 65, 90, 95, 122, 0
};
static const char _tsip_machine_parser_header_Allow_single_lengths[] = {
0, 2, 2, 2, 2, 2, 3, 7,
1, 8, 4, 1, 2, 3, 7, 1,
2, 6, 0
};
static const char _tsip_machine_parser_header_Allow_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 5,
0, 4, 0, 0, 0, 0, 5, 0,
0, 5, 0
};
static const char _tsip_machine_parser_header_Allow_index_offsets[] = {
0, 0, 3, 6, 9, 12, 15, 19,
32, 34, 47, 52, 54, 57, 61, 74,
76, 79, 91
};
static const char _tsip_machine_parser_header_Allow_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 5, 5, 1, 5,
5, 6, 1, 6, 7, 6, 8, 8,
8, 8, 8, 8, 8, 8, 8, 1,
9, 1, 10, 11, 10, 12, 12, 12,
13, 12, 12, 12, 12, 12, 1, 14,
15, 14, 16, 1, 17, 1, 18, 18,
1, 18, 18, 16, 1, 16, 19, 16,
8, 8, 8, 8, 8, 8, 8, 8,
8, 1, 20, 1, 21, 21, 1, 21,
21, 8, 8, 8, 8, 8, 8, 8,
8, 8, 1, 1, 0
};
static const char _tsip_machine_parser_header_Allow_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 18, 10, 8, 9, 14, 10, 11,
14, 12, 13, 15, 16, 17
};
static const char _tsip_machine_parser_header_Allow_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
1, 5, 3, 3, 0, 3, 0, 0,
0, 0, 0, 0, 0, 0
};
static const int tsip_machine_parser_header_Allow_start = 1;
static const int tsip_machine_parser_header_Allow_first_final = 18;
static const int tsip_machine_parser_header_Allow_error = 0;
@ -164,127 +94,313 @@ static const int tsip_machine_parser_header_Allow_error = 0;
static const int tsip_machine_parser_header_Allow_en_main = 1;
/* #line 112 "tsip_parser_header_Allow.rl" */
/* #line 110 "tsip_parser_header_Allow.rl" */
/* #line 170 "../source/headers/tsip_header_Allow.c" */
/* #line 100 "../source/headers/tsip_header_Allow.c" */
{
cs = tsip_machine_parser_header_Allow_start;
}
/* #line 113 "tsip_parser_header_Allow.rl" */
/* #line 111 "tsip_parser_header_Allow.rl" */
/* #line 177 "../source/headers/tsip_header_Allow.c" */
/* #line 107 "../source/headers/tsip_header_Allow.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Allow_trans_keys + _tsip_machine_parser_header_Allow_key_offsets[cs];
_trans = _tsip_machine_parser_header_Allow_index_offsets[cs];
_klen = _tsip_machine_parser_header_Allow_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Allow_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Allow_indicies[_trans];
cs = _tsip_machine_parser_header_Allow_trans_targs[_trans];
if ( _tsip_machine_parser_header_Allow_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Allow_actions + _tsip_machine_parser_header_Allow_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
/* #line 51 "tsip_parser_header_Allow.rl" */
{
TSK_DEBUG_INFO("ALLOW:TAG");
tag_start = p;
case 1:
switch( (*p) ) {
case 65: goto st2;
case 97: goto st2;
}
break;
case 1:
/* #line 57 "tsip_parser_header_Allow.rl" */
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 76: goto st3;
case 108: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 76: goto st4;
case 108: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 79: goto st5;
case 111: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 87: goto st6;
case 119: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 9: goto st6;
case 32: goto st6;
case 58: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 9: goto st7;
case 13: goto st8;
case 32: goto st7;
case 33: goto tr8;
case 37: goto tr8;
case 39: goto tr8;
case 126: goto tr8;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr8;
} else if ( (*p) >= 42 )
goto tr8;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr8;
} else if ( (*p) >= 65 )
goto tr8;
} else
goto tr8;
goto st0;
tr11:
/* #line 56 "tsip_parser_header_Allow.rl" */
{
PARSER_ADD_STRING(hdr_allow->methods);
}
break;
case 2:
/* #line 62 "tsip_parser_header_Allow.rl" */
goto st8;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
/* #line 206 "../source/headers/tsip_header_Allow.c" */
if ( (*p) == 10 )
goto tr9;
goto st0;
tr9:
/* #line 61 "tsip_parser_header_Allow.rl" */
{
TSK_DEBUG_INFO("ALLOW:EOB");
}
break;
/* #line 270 "../source/headers/tsip_header_Allow.c" */
}
goto st18;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
/* #line 219 "../source/headers/tsip_header_Allow.c" */
goto st0;
tr8:
/* #line 51 "tsip_parser_header_Allow.rl" */
{
tag_start = p;
}
goto st9;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
/* #line 231 "../source/headers/tsip_header_Allow.c" */
switch( (*p) ) {
case 9: goto tr10;
case 13: goto tr11;
case 32: goto tr10;
case 33: goto st9;
case 37: goto st9;
case 39: goto st9;
case 44: goto tr13;
case 126: goto st9;
}
if ( (*p) < 48 ) {
if ( 42 <= (*p) && (*p) <= 46 )
goto st9;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto st9;
} else if ( (*p) >= 65 )
goto st9;
} else
goto st9;
goto st0;
tr10:
/* #line 56 "tsip_parser_header_Allow.rl" */
{
PARSER_ADD_STRING(hdr_allow->methods);
}
goto st10;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
/* #line 264 "../source/headers/tsip_header_Allow.c" */
switch( (*p) ) {
case 9: goto st10;
case 13: goto st11;
case 32: goto st10;
case 44: goto st14;
}
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
if ( (*p) == 10 )
goto st12;
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 9: goto st13;
case 32: goto st13;
}
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 9: goto st13;
case 32: goto st13;
case 44: goto st14;
}
goto st0;
tr13:
/* #line 56 "tsip_parser_header_Allow.rl" */
{
PARSER_ADD_STRING(hdr_allow->methods);
}
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 308 "../source/headers/tsip_header_Allow.c" */
switch( (*p) ) {
case 9: goto st14;
case 13: goto st15;
case 32: goto st14;
case 33: goto tr8;
case 37: goto tr8;
case 39: goto tr8;
case 126: goto tr8;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr8;
} else if ( (*p) >= 42 )
goto tr8;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr8;
} else if ( (*p) >= 65 )
goto tr8;
} else
goto tr8;
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
if ( (*p) == 10 )
goto st16;
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
}
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
case 33: goto tr8;
case 37: goto tr8;
case 39: goto tr8;
case 126: goto tr8;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr8;
} else if ( (*p) >= 42 )
goto tr8;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr8;
} else if ( (*p) >= 65 )
goto tr8;
} else
goto tr8;
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 114 "tsip_parser_header_Allow.rl" */
/* #line 112 "tsip_parser_header_Allow.rl" */
if( cs <
/* #line 286 "../source/headers/tsip_header_Allow.c" */
/* #line 402 "../source/headers/tsip_header_Allow.c" */
18
/* #line 115 "tsip_parser_header_Allow.rl" */
/* #line 113 "tsip_parser_header_Allow.rl" */
)
{
TSIP_HEADER_ALLOW_SAFE_FREE(hdr_allow);

View File

@ -46,7 +46,7 @@
* Ragel state machine.
*/
/* #line 77 "tsip_parser_header_Allow_Events.rl" */
/* #line 75 "tsip_parser_header_Allow_Events.rl" */
int tsip_header_Allow_Event_tostring(const void* header, tsk_buffer_t* output)
@ -89,86 +89,6 @@ tsip_header_Allow_Events_t *tsip_header_Allow_Events_parse(const char *data, siz
/* #line 92 "../source/headers/tsip_header_Allow_Events.c" */
static const char _tsip_machine_parser_header_Allow_events_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Allow_events_key_offsets[] = {
0, 0, 4, 6, 8, 10, 12, 13,
15, 17, 19, 21, 23, 25, 28, 44,
45, 47, 62, 79, 83, 84, 86, 89,
90, 103
};
static const char _tsip_machine_parser_header_Allow_events_trans_keys[] = {
65, 85, 97, 117, 76, 108, 76, 108,
79, 111, 87, 119, 45, 69, 101, 86,
118, 69, 101, 78, 110, 84, 116, 83,
115, 9, 32, 58, 9, 13, 32, 33,
37, 39, 45, 126, 42, 43, 48, 57,
65, 90, 95, 122, 10, 9, 32, 9,
32, 33, 37, 39, 45, 126, 42, 43,
48, 57, 65, 90, 95, 122, 9, 13,
32, 33, 37, 39, 44, 46, 126, 42,
45, 48, 57, 65, 90, 95, 122, 9,
13, 32, 44, 10, 9, 32, 9, 32,
44, 10, 33, 37, 39, 45, 126, 42,
43, 48, 57, 65, 90, 95, 122, 0
};
static const char _tsip_machine_parser_header_Allow_events_single_lengths[] = {
0, 4, 2, 2, 2, 2, 1, 2,
2, 2, 2, 2, 2, 3, 8, 1,
2, 7, 9, 4, 1, 2, 3, 1,
5, 0
};
static const char _tsip_machine_parser_header_Allow_events_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 4, 0,
0, 4, 4, 0, 0, 0, 0, 0,
4, 0
};
static const unsigned char _tsip_machine_parser_header_Allow_events_index_offsets[] = {
0, 0, 5, 8, 11, 14, 17, 19,
22, 25, 28, 31, 34, 37, 41, 54,
56, 59, 71, 85, 90, 92, 95, 99,
101, 111
};
static const char _tsip_machine_parser_header_Allow_events_indicies[] = {
0, 2, 0, 2, 1, 3, 3, 1,
4, 4, 1, 5, 5, 1, 6, 6,
1, 7, 1, 8, 8, 1, 9, 9,
1, 10, 10, 1, 11, 11, 1, 12,
12, 1, 2, 2, 1, 2, 2, 13,
1, 13, 14, 13, 15, 15, 15, 15,
15, 15, 15, 15, 15, 1, 16, 1,
17, 17, 1, 17, 17, 15, 15, 15,
15, 15, 15, 15, 15, 15, 1, 18,
19, 18, 20, 20, 20, 21, 22, 20,
20, 20, 20, 20, 1, 23, 24, 23,
13, 1, 25, 1, 26, 26, 1, 26,
26, 13, 1, 27, 1, 20, 20, 20,
20, 20, 20, 20, 20, 20, 1, 1,
0
};
static const char _tsip_machine_parser_header_Allow_events_trans_targs[] = {
2, 0, 13, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 14, 15, 18,
16, 17, 19, 23, 18, 14, 24, 19,
20, 21, 22, 25
};
static const char _tsip_machine_parser_header_Allow_events_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 3, 3, 0, 3, 0, 0,
0, 0, 0, 5
};
static const int tsip_machine_parser_header_Allow_events_start = 1;
static const int tsip_machine_parser_header_Allow_events_first_final = 25;
static const int tsip_machine_parser_header_Allow_events_error = 0;
@ -176,127 +96,375 @@ static const int tsip_machine_parser_header_Allow_events_error = 0;
static const int tsip_machine_parser_header_Allow_events_en_main = 1;
/* #line 118 "tsip_parser_header_Allow_Events.rl" */
/* #line 116 "tsip_parser_header_Allow_Events.rl" */
/* #line 182 "../source/headers/tsip_header_Allow_Events.c" */
/* #line 102 "../source/headers/tsip_header_Allow_Events.c" */
{
cs = tsip_machine_parser_header_Allow_events_start;
}
/* #line 119 "tsip_parser_header_Allow_Events.rl" */
/* #line 117 "tsip_parser_header_Allow_Events.rl" */
/* #line 189 "../source/headers/tsip_header_Allow_Events.c" */
/* #line 109 "../source/headers/tsip_header_Allow_Events.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Allow_events_trans_keys + _tsip_machine_parser_header_Allow_events_key_offsets[cs];
_trans = _tsip_machine_parser_header_Allow_events_index_offsets[cs];
_klen = _tsip_machine_parser_header_Allow_events_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Allow_events_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Allow_events_indicies[_trans];
cs = _tsip_machine_parser_header_Allow_events_trans_targs[_trans];
if ( _tsip_machine_parser_header_Allow_events_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Allow_events_actions + _tsip_machine_parser_header_Allow_events_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
/* #line 53 "tsip_parser_header_Allow_Events.rl" */
{
TSK_DEBUG_INFO("ALLOW_EVENTS:TAG");
tag_start = p;
case 1:
switch( (*p) ) {
case 65: goto st2;
case 85: goto st13;
case 97: goto st2;
case 117: goto st13;
}
break;
case 1:
/* #line 59 "tsip_parser_header_Allow_Events.rl" */
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 76: goto st3;
case 108: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 76: goto st4;
case 108: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 79: goto st5;
case 111: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 87: goto st6;
case 119: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
if ( (*p) == 45 )
goto st7;
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 69: goto st8;
case 101: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 86: goto st9;
case 118: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 69: goto st10;
case 101: goto st10;
}
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
switch( (*p) ) {
case 78: goto st11;
case 110: goto st11;
}
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 84: goto st12;
case 116: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 83: goto st13;
case 115: goto st13;
}
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 9: goto st13;
case 32: goto st13;
case 58: goto st14;
}
goto st0;
tr21:
/* #line 58 "tsip_parser_header_Allow_Events.rl" */
{
PARSER_ADD_STRING(hdr_allow_events->events);
}
break;
case 2:
/* #line 64 "tsip_parser_header_Allow_Events.rl" */
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 243 "../source/headers/tsip_header_Allow_Events.c" */
switch( (*p) ) {
case 9: goto st14;
case 13: goto st15;
case 32: goto st14;
case 33: goto tr15;
case 37: goto tr15;
case 39: goto tr15;
case 45: goto tr15;
case 126: goto tr15;
}
if ( (*p) < 48 ) {
if ( 42 <= (*p) && (*p) <= 43 )
goto tr15;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr15;
} else if ( (*p) >= 65 )
goto tr15;
} else
goto tr15;
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
if ( (*p) == 10 )
goto st16;
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
}
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
case 33: goto tr15;
case 37: goto tr15;
case 39: goto tr15;
case 45: goto tr15;
case 126: goto tr15;
}
if ( (*p) < 48 ) {
if ( 42 <= (*p) && (*p) <= 43 )
goto tr15;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr15;
} else if ( (*p) >= 65 )
goto tr15;
} else
goto tr15;
goto st0;
tr15:
/* #line 53 "tsip_parser_header_Allow_Events.rl" */
{
TSK_DEBUG_INFO("ALLOW_EVENTS:EOB");
tag_start = p;
}
break;
/* #line 282 "../source/headers/tsip_header_Allow_Events.c" */
}
goto st18;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
/* #line 317 "../source/headers/tsip_header_Allow_Events.c" */
switch( (*p) ) {
case 9: goto tr18;
case 13: goto tr19;
case 32: goto tr18;
case 33: goto st18;
case 37: goto st18;
case 39: goto st18;
case 44: goto tr21;
case 46: goto st24;
case 126: goto st18;
}
if ( (*p) < 48 ) {
if ( 42 <= (*p) && (*p) <= 45 )
goto st18;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto st18;
} else if ( (*p) >= 65 )
goto st18;
} else
goto st18;
goto st0;
tr18:
/* #line 58 "tsip_parser_header_Allow_Events.rl" */
{
PARSER_ADD_STRING(hdr_allow_events->events);
}
goto st19;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
/* #line 351 "../source/headers/tsip_header_Allow_Events.c" */
switch( (*p) ) {
case 9: goto st19;
case 13: goto st20;
case 32: goto st19;
case 44: goto st14;
}
goto st0;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
if ( (*p) == 10 )
goto st21;
goto st0;
st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
switch( (*p) ) {
case 9: goto st22;
case 32: goto st22;
}
goto st0;
st22:
if ( ++p == pe )
goto _test_eof22;
case 22:
switch( (*p) ) {
case 9: goto st22;
case 32: goto st22;
case 44: goto st14;
}
goto st0;
tr19:
/* #line 58 "tsip_parser_header_Allow_Events.rl" */
{
PARSER_ADD_STRING(hdr_allow_events->events);
}
goto st23;
st23:
if ( ++p == pe )
goto _test_eof23;
case 23:
/* #line 395 "../source/headers/tsip_header_Allow_Events.c" */
if ( (*p) == 10 )
goto tr27;
goto st0;
tr27:
/* #line 63 "tsip_parser_header_Allow_Events.rl" */
{
}
goto st25;
st25:
if ( ++p == pe )
goto _test_eof25;
case 25:
/* #line 408 "../source/headers/tsip_header_Allow_Events.c" */
goto st0;
st24:
if ( ++p == pe )
goto _test_eof24;
case 24:
switch( (*p) ) {
case 33: goto st18;
case 37: goto st18;
case 39: goto st18;
case 45: goto st18;
case 126: goto st18;
}
if ( (*p) < 48 ) {
if ( 42 <= (*p) && (*p) <= 43 )
goto st18;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto st18;
} else if ( (*p) >= 65 )
goto st18;
} else
goto st18;
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof23: cs = 23; goto _test_eof;
_test_eof25: cs = 25; goto _test_eof;
_test_eof24: cs = 24; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 120 "tsip_parser_header_Allow_Events.rl" */
/* #line 118 "tsip_parser_header_Allow_Events.rl" */
if( cs <
/* #line 298 "../source/headers/tsip_header_Allow_Events.c" */
/* #line 466 "../source/headers/tsip_header_Allow_Events.c" */
25
/* #line 121 "tsip_parser_header_Allow_Events.rl" */
/* #line 119 "tsip_parser_header_Allow_Events.rl" */
)
{
TSIP_HEADER_ALLOW_EVENTS_SAFE_FREE(hdr_allow_events);

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@
* Ragel state machine.
*/
/* #line 77 "tsip_parser_header_CSeq.rl" */
/* #line 73 "tsip_parser_header_CSeq.rl" */
int tsip_header_CSeq_tostring(const void* header, tsk_buffer_t* output)
@ -68,74 +68,6 @@ tsip_header_CSeq_t *tsip_header_CSeq_parse(const char *data, size_t size)
/* #line 71 "../source/headers/tsip_header_CSeq.c" */
static const char _tsip_machine_parser_header_CSeq_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3
};
static const char _tsip_machine_parser_header_CSeq_key_offsets[] = {
0, 0, 2, 4, 6, 8, 11, 16,
17, 19, 23, 28, 45, 46, 48, 64,
79, 80
};
static const char _tsip_machine_parser_header_CSeq_trans_keys[] = {
67, 99, 83, 115, 69, 101, 81, 113,
9, 32, 58, 9, 13, 32, 48, 57,
10, 9, 32, 9, 32, 48, 57, 9,
13, 32, 48, 57, 9, 13, 32, 33,
37, 39, 126, 42, 43, 45, 46, 48,
57, 65, 90, 95, 122, 10, 9, 32,
9, 32, 33, 37, 39, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
13, 33, 37, 39, 126, 42, 43, 45,
46, 48, 57, 65, 90, 95, 122, 10,
0
};
static const char _tsip_machine_parser_header_CSeq_single_lengths[] = {
0, 2, 2, 2, 2, 3, 3, 1,
2, 2, 3, 7, 1, 2, 6, 5,
1, 0
};
static const char _tsip_machine_parser_header_CSeq_range_lengths[] = {
0, 0, 0, 0, 0, 0, 1, 0,
0, 1, 1, 5, 0, 0, 5, 5,
0, 0
};
static const char _tsip_machine_parser_header_CSeq_index_offsets[] = {
0, 0, 3, 6, 9, 12, 16, 21,
23, 26, 30, 35, 48, 50, 53, 65,
76, 78
};
static const char _tsip_machine_parser_header_CSeq_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 4, 4, 5, 1,
5, 6, 5, 7, 1, 8, 1, 9,
9, 1, 9, 9, 7, 1, 10, 11,
10, 12, 1, 13, 14, 13, 15, 15,
15, 15, 15, 15, 15, 15, 15, 1,
16, 1, 17, 17, 1, 17, 17, 15,
15, 15, 15, 15, 15, 15, 15, 15,
1, 18, 19, 19, 19, 19, 19, 19,
19, 19, 19, 1, 20, 1, 1, 0
};
static const char _tsip_machine_parser_header_CSeq_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 10,
8, 9, 11, 12, 10, 11, 12, 15,
13, 14, 16, 15, 17
};
static const char _tsip_machine_parser_header_CSeq_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 5, 5, 0, 0, 0, 1,
0, 0, 3, 0, 7
};
static const int tsip_machine_parser_header_CSeq_start = 1;
static const int tsip_machine_parser_header_CSeq_first_final = 17;
static const int tsip_machine_parser_header_CSeq_error = 0;
@ -143,135 +75,296 @@ static const int tsip_machine_parser_header_CSeq_error = 0;
static const int tsip_machine_parser_header_CSeq_en_main = 1;
/* #line 100 "tsip_parser_header_CSeq.rl" */
/* #line 96 "tsip_parser_header_CSeq.rl" */
/* #line 149 "../source/headers/tsip_header_CSeq.c" */
/* #line 81 "../source/headers/tsip_header_CSeq.c" */
{
cs = tsip_machine_parser_header_CSeq_start;
}
/* #line 101 "tsip_parser_header_CSeq.rl" */
/* #line 97 "tsip_parser_header_CSeq.rl" */
/* #line 156 "../source/headers/tsip_header_CSeq.c" */
/* #line 88 "../source/headers/tsip_header_CSeq.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_CSeq_trans_keys + _tsip_machine_parser_header_CSeq_key_offsets[cs];
_trans = _tsip_machine_parser_header_CSeq_index_offsets[cs];
_klen = _tsip_machine_parser_header_CSeq_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_CSeq_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_CSeq_indicies[_trans];
cs = _tsip_machine_parser_header_CSeq_trans_targs[_trans];
if ( _tsip_machine_parser_header_CSeq_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_CSeq_actions + _tsip_machine_parser_header_CSeq_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 67: goto st2;
case 99: goto st2;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 83: goto st3;
case 115: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 69: goto st4;
case 101: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 81: goto st5;
case 113: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 9: goto st5;
case 32: goto st5;
case 58: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 9: goto st6;
case 13: goto st7;
case 32: goto st6;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr7;
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
if ( (*p) == 10 )
goto st8;
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 9: goto st9;
case 32: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 9: goto st9;
case 32: goto st9;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr7;
goto st0;
tr7:
/* #line 50 "tsip_parser_header_CSeq.rl" */
{
TSK_DEBUG_INFO("CSEQ:TAG");
tag_start = p;
}
break;
case 1:
/* #line 56 "tsip_parser_header_CSeq.rl" */
{
PARSER_SET_STRING(hdr_cseq->method);
TSK_DEBUG_INFO("CSEQ:PARSE_METHOD");
goto st10;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
/* #line 189 "../source/headers/tsip_header_CSeq.c" */
switch( (*p) ) {
case 9: goto tr10;
case 13: goto tr11;
case 32: goto tr10;
}
break;
case 2:
/* #line 62 "tsip_parser_header_CSeq.rl" */
if ( 48 <= (*p) && (*p) <= 57 )
goto st10;
goto st0;
tr10:
/* #line 60 "tsip_parser_header_CSeq.rl" */
{
PARSER_SET_INTEGER(hdr_cseq->seq);
TSK_DEBUG_INFO("CSEQ:PARSE_SEQ");
}
break;
case 3:
/* #line 68 "tsip_parser_header_CSeq.rl" */
goto st11;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
/* #line 208 "../source/headers/tsip_header_CSeq.c" */
switch( (*p) ) {
case 9: goto st11;
case 13: goto st12;
case 32: goto st11;
case 33: goto tr15;
case 37: goto tr15;
case 39: goto tr15;
case 126: goto tr15;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr15;
} else if ( (*p) >= 42 )
goto tr15;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr15;
} else if ( (*p) >= 65 )
goto tr15;
} else
goto tr15;
goto st0;
tr11:
/* #line 60 "tsip_parser_header_CSeq.rl" */
{
TSK_DEBUG_INFO("CSEQ:EOB");
PARSER_SET_INTEGER(hdr_cseq->seq);
}
break;
/* #line 257 "../source/headers/tsip_header_CSeq.c" */
}
goto st12;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
/* #line 243 "../source/headers/tsip_header_CSeq.c" */
if ( (*p) == 10 )
goto st13;
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 9: goto st14;
case 32: goto st14;
}
goto st0;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
switch( (*p) ) {
case 9: goto st14;
case 32: goto st14;
case 33: goto tr15;
case 37: goto tr15;
case 39: goto tr15;
case 126: goto tr15;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr15;
} else if ( (*p) >= 42 )
goto tr15;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr15;
} else if ( (*p) >= 65 )
goto tr15;
} else
goto tr15;
goto st0;
tr15:
/* #line 50 "tsip_parser_header_CSeq.rl" */
{
tag_start = p;
}
goto st15;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
/* #line 293 "../source/headers/tsip_header_CSeq.c" */
switch( (*p) ) {
case 13: goto tr18;
case 33: goto st15;
case 37: goto st15;
case 39: goto st15;
case 126: goto st15;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st15;
} else if ( (*p) >= 42 )
goto st15;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto st15;
} else if ( (*p) >= 65 )
goto st15;
} else
goto st15;
goto st0;
tr18:
/* #line 55 "tsip_parser_header_CSeq.rl" */
{
PARSER_SET_STRING(hdr_cseq->method);
}
goto st16;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
/* #line 326 "../source/headers/tsip_header_CSeq.c" */
if ( (*p) == 10 )
goto tr20;
goto st0;
tr20:
/* #line 65 "tsip_parser_header_CSeq.rl" */
{
}
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
/* #line 339 "../source/headers/tsip_header_CSeq.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 102 "tsip_parser_header_CSeq.rl" */
/* #line 98 "tsip_parser_header_CSeq.rl" */
if( cs <
/* #line 273 "../source/headers/tsip_header_CSeq.c" */
/* #line 366 "../source/headers/tsip_header_CSeq.c" */
17
/* #line 103 "tsip_parser_header_CSeq.rl" */
/* #line 99 "tsip_parser_header_CSeq.rl" */
)
{
TSIP_HEADER_CSEQ_SAFE_FREE(hdr_cseq);

View File

@ -46,7 +46,7 @@
* Ragel state machine.
*/
/* #line 75 "tsip_parser_header_Call_ID.rl" */
/* #line 72 "tsip_parser_header_Call_ID.rl" */
int tsip_header_Call_ID_tostring(const void* header, tsk_buffer_t* output)
@ -80,78 +80,6 @@ tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size)
/* #line 83 "../source/headers/tsip_header_Call_ID.c" */
static const char _tsip_machine_parser_header_Call_ID_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Call_ID_key_offsets[] = {
0, 0, 4, 6, 8, 10, 11, 13,
15, 18, 37, 38, 40, 58, 74, 75,
91, 108
};
static const char _tsip_machine_parser_header_Call_ID_trans_keys[] = {
67, 73, 99, 105, 65, 97, 76, 108,
76, 108, 45, 73, 105, 68, 100, 9,
32, 58, 9, 13, 32, 37, 60, 33,
34, 39, 43, 45, 58, 62, 63, 65,
93, 95, 123, 125, 126, 10, 9, 32,
9, 32, 37, 60, 33, 34, 39, 43,
45, 58, 62, 63, 65, 93, 95, 123,
125, 126, 13, 37, 60, 64, 33, 34,
39, 43, 45, 58, 62, 93, 95, 123,
125, 126, 10, 37, 60, 33, 34, 39,
43, 45, 58, 62, 63, 65, 93, 95,
123, 125, 126, 13, 37, 60, 33, 34,
39, 43, 45, 58, 62, 63, 65, 93,
95, 123, 125, 126, 0
};
static const char _tsip_machine_parser_header_Call_ID_single_lengths[] = {
0, 4, 2, 2, 2, 1, 2, 2,
3, 5, 1, 2, 4, 4, 1, 2,
3, 0
};
static const char _tsip_machine_parser_header_Call_ID_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 7, 0, 0, 7, 6, 0, 7,
7, 0
};
static const char _tsip_machine_parser_header_Call_ID_index_offsets[] = {
0, 0, 5, 8, 11, 14, 16, 19,
22, 26, 39, 41, 44, 56, 67, 69,
79, 90
};
static const char _tsip_machine_parser_header_Call_ID_indicies[] = {
0, 2, 0, 2, 1, 3, 3, 1,
4, 4, 1, 5, 5, 1, 6, 1,
7, 7, 1, 2, 2, 1, 2, 2,
8, 1, 8, 9, 8, 10, 10, 10,
10, 10, 10, 10, 10, 10, 1, 11,
1, 12, 12, 1, 12, 12, 10, 10,
10, 10, 10, 10, 10, 10, 10, 1,
13, 14, 14, 15, 14, 14, 14, 14,
14, 14, 1, 16, 1, 17, 17, 17,
17, 17, 17, 17, 17, 17, 1, 13,
17, 17, 17, 17, 17, 17, 17, 17,
17, 1, 1, 0
};
static const char _tsip_machine_parser_header_Call_ID_trans_targs[] = {
2, 0, 8, 3, 4, 5, 6, 7,
9, 10, 13, 11, 12, 14, 13, 15,
17, 16
};
static const char _tsip_machine_parser_header_Call_ID_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 3, 0, 0,
5, 0
};
static const int tsip_machine_parser_header_Call_ID_start = 1;
static const int tsip_machine_parser_header_Call_ID_first_final = 17;
static const int tsip_machine_parser_header_Call_ID_error = 0;
@ -159,128 +87,320 @@ static const int tsip_machine_parser_header_Call_ID_error = 0;
static const int tsip_machine_parser_header_Call_ID_en_main = 1;
/* #line 107 "tsip_parser_header_Call_ID.rl" */
/* #line 104 "tsip_parser_header_Call_ID.rl" */
/* #line 165 "../source/headers/tsip_header_Call_ID.c" */
/* #line 93 "../source/headers/tsip_header_Call_ID.c" */
{
cs = tsip_machine_parser_header_Call_ID_start;
}
/* #line 108 "tsip_parser_header_Call_ID.rl" */
/* #line 105 "tsip_parser_header_Call_ID.rl" */
/* #line 172 "../source/headers/tsip_header_Call_ID.c" */
/* #line 100 "../source/headers/tsip_header_Call_ID.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Call_ID_trans_keys + _tsip_machine_parser_header_Call_ID_key_offsets[cs];
_trans = _tsip_machine_parser_header_Call_ID_index_offsets[cs];
_klen = _tsip_machine_parser_header_Call_ID_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Call_ID_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Call_ID_indicies[_trans];
cs = _tsip_machine_parser_header_Call_ID_trans_targs[_trans];
if ( _tsip_machine_parser_header_Call_ID_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Call_ID_actions + _tsip_machine_parser_header_Call_ID_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 67: goto st2;
case 73: goto st8;
case 99: goto st2;
case 105: goto st8;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 65: goto st3;
case 97: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 76: goto st4;
case 108: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 76: goto st5;
case 108: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
if ( (*p) == 45 )
goto st6;
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 73: goto st7;
case 105: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 68: goto st8;
case 100: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 9: goto st8;
case 32: goto st8;
case 58: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 9: goto st9;
case 13: goto st10;
case 32: goto st9;
case 37: goto tr10;
case 60: goto tr10;
}
if ( (*p) < 62 ) {
if ( (*p) < 39 ) {
if ( 33 <= (*p) && (*p) <= 34 )
goto tr10;
} else if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 58 )
goto tr10;
} else
goto tr10;
} else if ( (*p) > 63 ) {
if ( (*p) < 95 ) {
if ( 65 <= (*p) && (*p) <= 93 )
goto tr10;
} else if ( (*p) > 123 ) {
if ( 125 <= (*p) && (*p) <= 126 )
goto tr10;
} else
goto tr10;
} else
goto tr10;
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
if ( (*p) == 10 )
goto st11;
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
case 37: goto tr10;
case 60: goto tr10;
}
if ( (*p) < 62 ) {
if ( (*p) < 39 ) {
if ( 33 <= (*p) && (*p) <= 34 )
goto tr10;
} else if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 58 )
goto tr10;
} else
goto tr10;
} else if ( (*p) > 63 ) {
if ( (*p) < 95 ) {
if ( 65 <= (*p) && (*p) <= 93 )
goto tr10;
} else if ( (*p) > 123 ) {
if ( 125 <= (*p) && (*p) <= 126 )
goto tr10;
} else
goto tr10;
} else
goto tr10;
goto st0;
tr10:
/* #line 53 "tsip_parser_header_Call_ID.rl" */
{
TSK_DEBUG_INFO("CALL_ID:TAG");
tag_start = p;
}
break;
case 1:
/* #line 59 "tsip_parser_header_Call_ID.rl" */
goto st13;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
/* #line 268 "../source/headers/tsip_header_Call_ID.c" */
switch( (*p) ) {
case 13: goto tr13;
case 37: goto st13;
case 60: goto st13;
case 64: goto st15;
}
if ( (*p) < 45 ) {
if ( (*p) > 34 ) {
if ( 39 <= (*p) && (*p) <= 43 )
goto st13;
} else if ( (*p) >= 33 )
goto st13;
} else if ( (*p) > 58 ) {
if ( (*p) < 95 ) {
if ( 62 <= (*p) && (*p) <= 93 )
goto st13;
} else if ( (*p) > 123 ) {
if ( 125 <= (*p) && (*p) <= 126 )
goto st13;
} else
goto st13;
} else
goto st13;
goto st0;
tr13:
/* #line 58 "tsip_parser_header_Call_ID.rl" */
{
PARSER_SET_STRING(hdr_call_id->value);
TSK_DEBUG_INFO("CALL_ID:PARSE_VALUE");
}
break;
case 2:
/* #line 65 "tsip_parser_header_Call_ID.rl" */
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 303 "../source/headers/tsip_header_Call_ID.c" */
if ( (*p) == 10 )
goto tr16;
goto st0;
tr16:
/* #line 63 "tsip_parser_header_Call_ID.rl" */
{
TSK_DEBUG_INFO("CALL_ID:EOB");
}
break;
/* #line 266 "../source/headers/tsip_header_Call_ID.c" */
}
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
/* #line 316 "../source/headers/tsip_header_Call_ID.c" */
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
switch( (*p) ) {
case 37: goto st16;
case 60: goto st16;
}
if ( (*p) < 62 ) {
if ( (*p) < 39 ) {
if ( 33 <= (*p) && (*p) <= 34 )
goto st16;
} else if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 58 )
goto st16;
} else
goto st16;
} else if ( (*p) > 63 ) {
if ( (*p) < 95 ) {
if ( 65 <= (*p) && (*p) <= 93 )
goto st16;
} else if ( (*p) > 123 ) {
if ( 125 <= (*p) && (*p) <= 126 )
goto st16;
} else
goto st16;
} else
goto st16;
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 13: goto tr13;
case 37: goto st16;
case 60: goto st16;
}
if ( (*p) < 62 ) {
if ( (*p) < 39 ) {
if ( 33 <= (*p) && (*p) <= 34 )
goto st16;
} else if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 58 )
goto st16;
} else
goto st16;
} else if ( (*p) > 63 ) {
if ( (*p) < 95 ) {
if ( 65 <= (*p) && (*p) <= 93 )
goto st16;
} else if ( (*p) > 123 ) {
if ( 125 <= (*p) && (*p) <= 126 )
goto st16;
} else
goto st16;
} else
goto st16;
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 109 "tsip_parser_header_Call_ID.rl" */
/* #line 106 "tsip_parser_header_Call_ID.rl" */
if( cs <
/* #line 282 "../source/headers/tsip_header_Call_ID.c" */
/* #line 402 "../source/headers/tsip_header_Call_ID.c" */
17
/* #line 110 "tsip_parser_header_Call_ID.rl" */
/* #line 107 "tsip_parser_header_Call_ID.rl" */
)
{
TSIP_HEADER_CALL_ID_SAFE_FREE(hdr_call_id);

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@
* Ragel state machine.
*/
/* #line 71 "tsip_parser_header_Content_Length.rl" */
/* #line 68 "tsip_parser_header_Content_Length.rl" */
int tsip_header_Content_Length_tostring(const void* header, tsk_buffer_t* output)
@ -69,68 +69,6 @@ tsip_header_Content_Length_t *tsip_header_Content_Length_parse(const char *data,
/* #line 72 "../source/headers/tsip_header_Content_Length.c" */
static const char _tsip_machine_parser_header_Content_Length_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Content_Length_key_offsets[] = {
0, 0, 4, 6, 8, 10, 12, 14,
16, 17, 19, 21, 23, 25, 27, 29,
32, 37, 38, 40, 44, 47, 48
};
static const char _tsip_machine_parser_header_Content_Length_trans_keys[] = {
67, 76, 99, 108, 79, 111, 78, 110,
84, 116, 69, 101, 78, 110, 84, 116,
45, 76, 108, 69, 101, 78, 110, 71,
103, 84, 116, 72, 104, 9, 32, 58,
9, 13, 32, 48, 57, 10, 9, 32,
9, 32, 48, 57, 13, 48, 57, 10,
0
};
static const char _tsip_machine_parser_header_Content_Length_single_lengths[] = {
0, 4, 2, 2, 2, 2, 2, 2,
1, 2, 2, 2, 2, 2, 2, 3,
3, 1, 2, 2, 1, 1, 0
};
static const char _tsip_machine_parser_header_Content_Length_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 1, 1, 0, 0
};
static const char _tsip_machine_parser_header_Content_Length_index_offsets[] = {
0, 0, 5, 8, 11, 14, 17, 20,
23, 25, 28, 31, 34, 37, 40, 43,
47, 52, 54, 57, 61, 64, 66
};
static const char _tsip_machine_parser_header_Content_Length_indicies[] = {
0, 2, 0, 2, 1, 3, 3, 1,
4, 4, 1, 5, 5, 1, 6, 6,
1, 7, 7, 1, 8, 8, 1, 9,
1, 10, 10, 1, 11, 11, 1, 12,
12, 1, 13, 13, 1, 14, 14, 1,
2, 2, 1, 2, 2, 15, 1, 15,
16, 15, 17, 1, 18, 1, 19, 19,
1, 19, 19, 17, 1, 20, 21, 1,
22, 1, 1, 0
};
static const char _tsip_machine_parser_header_Content_Length_trans_targs[] = {
2, 0, 15, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 16,
17, 20, 18, 19, 21, 20, 22
};
static const char _tsip_machine_parser_header_Content_Length_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 3, 0, 5
};
static const int tsip_machine_parser_header_Content_Length_start = 1;
static const int tsip_machine_parser_header_Content_Length_first_final = 22;
static const int tsip_machine_parser_header_Content_Length_error = 0;
@ -138,128 +76,270 @@ static const int tsip_machine_parser_header_Content_Length_error = 0;
static const int tsip_machine_parser_header_Content_Length_en_main = 1;
/* #line 95 "tsip_parser_header_Content_Length.rl" */
/* #line 92 "tsip_parser_header_Content_Length.rl" */
/* #line 144 "../source/headers/tsip_header_Content_Length.c" */
/* #line 82 "../source/headers/tsip_header_Content_Length.c" */
{
cs = tsip_machine_parser_header_Content_Length_start;
}
/* #line 96 "tsip_parser_header_Content_Length.rl" */
/* #line 93 "tsip_parser_header_Content_Length.rl" */
/* #line 151 "../source/headers/tsip_header_Content_Length.c" */
/* #line 89 "../source/headers/tsip_header_Content_Length.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Content_Length_trans_keys + _tsip_machine_parser_header_Content_Length_key_offsets[cs];
_trans = _tsip_machine_parser_header_Content_Length_index_offsets[cs];
_klen = _tsip_machine_parser_header_Content_Length_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Content_Length_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Content_Length_indicies[_trans];
cs = _tsip_machine_parser_header_Content_Length_trans_targs[_trans];
if ( _tsip_machine_parser_header_Content_Length_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Content_Length_actions + _tsip_machine_parser_header_Content_Length_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 67: goto st2;
case 76: goto st15;
case 99: goto st2;
case 108: goto st15;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 79: goto st3;
case 111: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 78: goto st4;
case 110: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 84: goto st5;
case 116: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 69: goto st6;
case 101: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 78: goto st7;
case 110: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 84: goto st8;
case 116: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
if ( (*p) == 45 )
goto st9;
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 76: goto st10;
case 108: goto st10;
}
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
switch( (*p) ) {
case 69: goto st11;
case 101: goto st11;
}
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 78: goto st12;
case 110: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 71: goto st13;
case 103: goto st13;
}
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 84: goto st14;
case 116: goto st14;
}
goto st0;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
switch( (*p) ) {
case 72: goto st15;
case 104: goto st15;
}
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
switch( (*p) ) {
case 9: goto st15;
case 32: goto st15;
case 58: goto st16;
}
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 9: goto st16;
case 13: goto st17;
case 32: goto st16;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr17;
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
if ( (*p) == 10 )
goto st18;
goto st0;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
switch( (*p) ) {
case 9: goto st19;
case 32: goto st19;
}
goto st0;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
switch( (*p) ) {
case 9: goto st19;
case 32: goto st19;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr17;
goto st0;
tr17:
/* #line 50 "tsip_parser_header_Content_Length.rl" */
{
TSK_DEBUG_INFO("CONTENT_LENGTH:TAG");
tag_start = p;
}
break;
case 1:
/* #line 56 "tsip_parser_header_Content_Length.rl" */
goto st20;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
/* #line 280 "../source/headers/tsip_header_Content_Length.c" */
if ( (*p) == 13 )
goto tr20;
if ( 48 <= (*p) && (*p) <= 57 )
goto st20;
goto st0;
tr20:
/* #line 55 "tsip_parser_header_Content_Length.rl" */
{
PARSER_SET_INTEGER(hdr_clength->length);
TSK_DEBUG_INFO("CONTENT_LENGTH:PARSE_CONTENT_LENGTH");
}
break;
case 2:
/* #line 62 "tsip_parser_header_Content_Length.rl" */
goto st21;
st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
/* #line 296 "../source/headers/tsip_header_Content_Length.c" */
if ( (*p) == 10 )
goto tr22;
goto st0;
tr22:
/* #line 60 "tsip_parser_header_Content_Length.rl" */
{
TSK_DEBUG_INFO("CONTENT_LENGTH:EOB");
}
break;
/* #line 245 "../source/headers/tsip_header_Content_Length.c" */
}
goto st22;
st22:
if ( ++p == pe )
goto _test_eof22;
case 22:
/* #line 309 "../source/headers/tsip_header_Content_Length.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 97 "tsip_parser_header_Content_Length.rl" */
/* #line 94 "tsip_parser_header_Content_Length.rl" */
if( cs <
/* #line 261 "../source/headers/tsip_header_Content_Length.c" */
/* #line 341 "../source/headers/tsip_header_Content_Length.c" */
22
/* #line 98 "tsip_parser_header_Content_Length.rl" */
/* #line 95 "tsip_parser_header_Content_Length.rl" */
)
{
TSIP_HEADER_CONTENT_LENGTH_SAFE_FREE(hdr_clength);

File diff suppressed because it is too large Load Diff

View File

@ -72,57 +72,6 @@ tsip_header_Expires_t *tsip_header_Expires_parse(const char *data, size_t size)
/* #line 75 "../source/headers/tsip_header_Expires.c" */
static const char _tsip_machine_parser_header_Expires_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Expires_key_offsets[] = {
0, 0, 2, 4, 6, 8, 10, 12,
14, 17, 22, 23, 25, 29, 32, 33
};
static const char _tsip_machine_parser_header_Expires_trans_keys[] = {
69, 101, 88, 120, 80, 112, 73, 105,
82, 114, 69, 101, 83, 115, 9, 32,
58, 9, 13, 32, 48, 57, 10, 9,
32, 9, 32, 48, 57, 13, 48, 57,
10, 0
};
static const char _tsip_machine_parser_header_Expires_single_lengths[] = {
0, 2, 2, 2, 2, 2, 2, 2,
3, 3, 1, 2, 2, 1, 1, 0
};
static const char _tsip_machine_parser_header_Expires_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 1, 1, 0, 0
};
static const char _tsip_machine_parser_header_Expires_index_offsets[] = {
0, 0, 3, 6, 9, 12, 15, 18,
21, 25, 30, 32, 35, 39, 42, 44
};
static const char _tsip_machine_parser_header_Expires_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 5, 5, 1, 6,
6, 1, 7, 7, 1, 7, 7, 8,
1, 8, 9, 8, 10, 1, 11, 1,
12, 12, 1, 12, 12, 10, 1, 13,
14, 1, 15, 1, 1, 0
};
static const char _tsip_machine_parser_header_Expires_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 13, 11, 12, 14, 13, 15
};
static const char _tsip_machine_parser_header_Expires_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 3, 0, 5
};
static const int tsip_machine_parser_header_Expires_start = 1;
static const int tsip_machine_parser_header_Expires_first_final = 15;
static const int tsip_machine_parser_header_Expires_error = 0;
@ -132,116 +81,191 @@ static const int tsip_machine_parser_header_Expires_en_main = 1;
/* #line 98 "tsip_parser_header_Expires.rl" */
/* #line 136 "../source/headers/tsip_header_Expires.c" */
/* #line 85 "../source/headers/tsip_header_Expires.c" */
{
cs = tsip_machine_parser_header_Expires_start;
}
/* #line 99 "tsip_parser_header_Expires.rl" */
/* #line 143 "../source/headers/tsip_header_Expires.c" */
/* #line 92 "../source/headers/tsip_header_Expires.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Expires_trans_keys + _tsip_machine_parser_header_Expires_key_offsets[cs];
_trans = _tsip_machine_parser_header_Expires_index_offsets[cs];
_klen = _tsip_machine_parser_header_Expires_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Expires_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Expires_indicies[_trans];
cs = _tsip_machine_parser_header_Expires_trans_targs[_trans];
if ( _tsip_machine_parser_header_Expires_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Expires_actions + _tsip_machine_parser_header_Expires_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 69: goto st2;
case 101: goto st2;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 88: goto st3;
case 120: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 80: goto st4;
case 112: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 73: goto st5;
case 105: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 82: goto st6;
case 114: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 69: goto st7;
case 101: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 83: goto st8;
case 115: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 9: goto st8;
case 32: goto st8;
case 58: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 9: goto st9;
case 13: goto st10;
case 32: goto st9;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr10;
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
if ( (*p) == 10 )
goto st11;
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr10;
goto st0;
tr10:
/* #line 50 "tsip_parser_header_Expires.rl" */
{
TSK_DEBUG_INFO("EXPIRES:TAG");
tag_start = p;
}
break;
case 1:
goto st13;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
/* #line 221 "../source/headers/tsip_header_Expires.c" */
if ( (*p) == 13 )
goto tr13;
if ( 48 <= (*p) && (*p) <= 57 )
goto st13;
goto st0;
tr13:
/* #line 56 "tsip_parser_header_Expires.rl" */
{
PARSER_SET_INTEGER(hdr_expires->delta_seconds);
TSK_DEBUG_INFO("EXPIRES:PARSE_DELTA_SECONDS");
}
break;
case 2:
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 238 "../source/headers/tsip_header_Expires.c" */
if ( (*p) == 10 )
goto tr15;
goto st0;
tr15:
/* #line 62 "tsip_parser_header_Expires.rl" */
{
TSK_DEBUG_INFO("EXPIRES:EOB");
}
break;
/* #line 237 "../source/headers/tsip_header_Expires.c" */
}
goto st15;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
/* #line 252 "../source/headers/tsip_header_Expires.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
@ -249,7 +273,7 @@ _again:
/* #line 100 "tsip_parser_header_Expires.rl" */
if( cs <
/* #line 253 "../source/headers/tsip_header_Expires.c" */
/* #line 277 "../source/headers/tsip_header_Expires.c" */
15
/* #line 101 "tsip_parser_header_Expires.rl" */
)

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@
* Ragel state machine.
*/
/* #line 71 "tsip_parser_header_Max_Forwards.rl" */
/* #line 68 "tsip_parser_header_Max_Forwards.rl" */
int tsip_header_Max_Forwards_tostring(const void* header, tsk_buffer_t* output)
@ -72,66 +72,6 @@ tsip_header_Max_Forwards_t *tsip_header_Max_Forwards_parse(const char *data, siz
/* #line 75 "../source/headers/tsip_header_Max_Forwards.c" */
static const char _tsip_machine_parser_header_Max_Forwards_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Max_Forwards_key_offsets[] = {
0, 0, 2, 4, 6, 7, 9, 11,
13, 15, 17, 19, 21, 23, 26, 31,
32, 34, 38, 41, 42
};
static const char _tsip_machine_parser_header_Max_Forwards_trans_keys[] = {
77, 109, 65, 97, 88, 120, 45, 70,
102, 79, 111, 82, 114, 87, 119, 65,
97, 82, 114, 68, 100, 83, 115, 9,
32, 58, 9, 13, 32, 48, 57, 10,
9, 32, 9, 32, 48, 57, 13, 48,
57, 10, 0
};
static const char _tsip_machine_parser_header_Max_Forwards_single_lengths[] = {
0, 2, 2, 2, 1, 2, 2, 2,
2, 2, 2, 2, 2, 3, 3, 1,
2, 2, 1, 1, 0
};
static const char _tsip_machine_parser_header_Max_Forwards_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0,
0, 1, 1, 0, 0
};
static const char _tsip_machine_parser_header_Max_Forwards_index_offsets[] = {
0, 0, 3, 6, 9, 11, 14, 17,
20, 23, 26, 29, 32, 35, 39, 44,
46, 49, 53, 56, 58
};
static const char _tsip_machine_parser_header_Max_Forwards_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 1, 5, 5, 1, 6, 6,
1, 7, 7, 1, 8, 8, 1, 9,
9, 1, 10, 10, 1, 11, 11, 1,
12, 12, 1, 12, 12, 13, 1, 13,
14, 13, 15, 1, 16, 1, 17, 17,
1, 17, 17, 15, 1, 18, 19, 1,
20, 1, 1, 0
};
static const char _tsip_machine_parser_header_Max_Forwards_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 18,
16, 17, 19, 18, 20
};
static const char _tsip_machine_parser_header_Max_Forwards_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 3, 0, 5
};
static const int tsip_machine_parser_header_Max_Forwards_start = 1;
static const int tsip_machine_parser_header_Max_Forwards_first_final = 20;
static const int tsip_machine_parser_header_Max_Forwards_error = 0;
@ -139,128 +79,248 @@ static const int tsip_machine_parser_header_Max_Forwards_error = 0;
static const int tsip_machine_parser_header_Max_Forwards_en_main = 1;
/* #line 98 "tsip_parser_header_Max_Forwards.rl" */
/* #line 95 "tsip_parser_header_Max_Forwards.rl" */
/* #line 145 "../source/headers/tsip_header_Max_Forwards.c" */
/* #line 85 "../source/headers/tsip_header_Max_Forwards.c" */
{
cs = tsip_machine_parser_header_Max_Forwards_start;
}
/* #line 99 "tsip_parser_header_Max_Forwards.rl" */
/* #line 96 "tsip_parser_header_Max_Forwards.rl" */
/* #line 152 "../source/headers/tsip_header_Max_Forwards.c" */
/* #line 92 "../source/headers/tsip_header_Max_Forwards.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Max_Forwards_trans_keys + _tsip_machine_parser_header_Max_Forwards_key_offsets[cs];
_trans = _tsip_machine_parser_header_Max_Forwards_index_offsets[cs];
_klen = _tsip_machine_parser_header_Max_Forwards_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Max_Forwards_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Max_Forwards_indicies[_trans];
cs = _tsip_machine_parser_header_Max_Forwards_trans_targs[_trans];
if ( _tsip_machine_parser_header_Max_Forwards_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Max_Forwards_actions + _tsip_machine_parser_header_Max_Forwards_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 77: goto st2;
case 109: goto st2;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 65: goto st3;
case 97: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 88: goto st4;
case 120: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
if ( (*p) == 45 )
goto st5;
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 70: goto st6;
case 102: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 79: goto st7;
case 111: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 82: goto st8;
case 114: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 87: goto st9;
case 119: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 65: goto st10;
case 97: goto st10;
}
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
switch( (*p) ) {
case 82: goto st11;
case 114: goto st11;
}
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 68: goto st12;
case 100: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 83: goto st13;
case 115: goto st13;
}
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 9: goto st13;
case 32: goto st13;
case 58: goto st14;
}
goto st0;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
switch( (*p) ) {
case 9: goto st14;
case 13: goto st15;
case 32: goto st14;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr15;
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
if ( (*p) == 10 )
goto st16;
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
}
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr15;
goto st0;
tr15:
/* #line 50 "tsip_parser_header_Max_Forwards.rl" */
{
TSK_DEBUG_INFO("MAX_FORWARDS:TAG");
tag_start = p;
}
break;
case 1:
/* #line 56 "tsip_parser_header_Max_Forwards.rl" */
goto st18;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
/* #line 263 "../source/headers/tsip_header_Max_Forwards.c" */
if ( (*p) == 13 )
goto tr18;
if ( 48 <= (*p) && (*p) <= 57 )
goto st18;
goto st0;
tr18:
/* #line 55 "tsip_parser_header_Max_Forwards.rl" */
{
PARSER_SET_INTEGER(hdr_maxf->value);
TSK_DEBUG_INFO("MAX_FORWARDS:PARSE_VALUE");
}
break;
case 2:
/* #line 62 "tsip_parser_header_Max_Forwards.rl" */
goto st19;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
/* #line 279 "../source/headers/tsip_header_Max_Forwards.c" */
if ( (*p) == 10 )
goto tr20;
goto st0;
tr20:
/* #line 60 "tsip_parser_header_Max_Forwards.rl" */
{
TSK_DEBUG_INFO("MAX_FORWARDS:EOB");
}
break;
/* #line 246 "../source/headers/tsip_header_Max_Forwards.c" */
}
goto st20;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
/* #line 292 "../source/headers/tsip_header_Max_Forwards.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 100 "tsip_parser_header_Max_Forwards.rl" */
/* #line 97 "tsip_parser_header_Max_Forwards.rl" */
if( cs <
/* #line 262 "../source/headers/tsip_header_Max_Forwards.c" */
/* #line 322 "../source/headers/tsip_header_Max_Forwards.c" */
20
/* #line 101 "tsip_parser_header_Max_Forwards.rl" */
/* #line 98 "tsip_parser_header_Max_Forwards.rl" */
)
{
TSIP_HEADER_MAX_FORWARDS_SAFE_FREE(hdr_maxf);

View File

@ -43,7 +43,7 @@
* Ragel state machine.
*/
/* #line 71 "tsip_parser_header_Min_Expires.rl" */
/* #line 68 "tsip_parser_header_Min_Expires.rl" */
int tsip_header_Min_Expires_tostring(const void* header, tsk_buffer_t* output)
@ -72,66 +72,6 @@ tsip_header_Min_Expires_t *tsip_header_Min_Expires_parse(const char *data, size_
/* #line 75 "../source/headers/tsip_header_Min_Expires.c" */
static const char _tsip_machine_parser_header_Min_Expires_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Min_Expires_key_offsets[] = {
0, 0, 2, 4, 6, 7, 9, 11,
13, 15, 17, 19, 21, 24, 29, 30,
32, 36, 39, 40
};
static const char _tsip_machine_parser_header_Min_Expires_trans_keys[] = {
77, 109, 73, 105, 78, 110, 45, 69,
101, 88, 120, 80, 112, 73, 105, 82,
114, 69, 101, 83, 115, 9, 32, 58,
9, 13, 32, 48, 57, 10, 9, 32,
9, 32, 48, 57, 13, 48, 57, 10,
0
};
static const char _tsip_machine_parser_header_Min_Expires_single_lengths[] = {
0, 2, 2, 2, 1, 2, 2, 2,
2, 2, 2, 2, 3, 3, 1, 2,
2, 1, 1, 0
};
static const char _tsip_machine_parser_header_Min_Expires_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0,
1, 1, 0, 0
};
static const char _tsip_machine_parser_header_Min_Expires_index_offsets[] = {
0, 0, 3, 6, 9, 11, 14, 17,
20, 23, 26, 29, 32, 36, 41, 43,
46, 50, 53, 55
};
static const char _tsip_machine_parser_header_Min_Expires_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 1, 5, 5, 1, 6, 6,
1, 7, 7, 1, 8, 8, 1, 9,
9, 1, 10, 10, 1, 11, 11, 1,
11, 11, 12, 1, 12, 13, 12, 14,
1, 15, 1, 16, 16, 1, 16, 16,
14, 1, 17, 18, 1, 19, 1, 1,
0
};
static const char _tsip_machine_parser_header_Min_Expires_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 17, 15,
16, 18, 17, 19
};
static const char _tsip_machine_parser_header_Min_Expires_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0,
0, 3, 0, 5
};
static const int tsip_machine_parser_header_Min_Expires_start = 1;
static const int tsip_machine_parser_header_Min_Expires_first_final = 19;
static const int tsip_machine_parser_header_Min_Expires_error = 0;
@ -139,128 +79,238 @@ static const int tsip_machine_parser_header_Min_Expires_error = 0;
static const int tsip_machine_parser_header_Min_Expires_en_main = 1;
/* #line 98 "tsip_parser_header_Min_Expires.rl" */
/* #line 95 "tsip_parser_header_Min_Expires.rl" */
/* #line 145 "../source/headers/tsip_header_Min_Expires.c" */
/* #line 85 "../source/headers/tsip_header_Min_Expires.c" */
{
cs = tsip_machine_parser_header_Min_Expires_start;
}
/* #line 99 "tsip_parser_header_Min_Expires.rl" */
/* #line 96 "tsip_parser_header_Min_Expires.rl" */
/* #line 152 "../source/headers/tsip_header_Min_Expires.c" */
/* #line 92 "../source/headers/tsip_header_Min_Expires.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Min_Expires_trans_keys + _tsip_machine_parser_header_Min_Expires_key_offsets[cs];
_trans = _tsip_machine_parser_header_Min_Expires_index_offsets[cs];
_klen = _tsip_machine_parser_header_Min_Expires_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Min_Expires_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Min_Expires_indicies[_trans];
cs = _tsip_machine_parser_header_Min_Expires_trans_targs[_trans];
if ( _tsip_machine_parser_header_Min_Expires_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Min_Expires_actions + _tsip_machine_parser_header_Min_Expires_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 77: goto st2;
case 109: goto st2;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 73: goto st3;
case 105: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 78: goto st4;
case 110: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
if ( (*p) == 45 )
goto st5;
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 69: goto st6;
case 101: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 88: goto st7;
case 120: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 80: goto st8;
case 112: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 73: goto st9;
case 105: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 82: goto st10;
case 114: goto st10;
}
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
switch( (*p) ) {
case 69: goto st11;
case 101: goto st11;
}
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 83: goto st12;
case 115: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
case 58: goto st13;
}
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 9: goto st13;
case 13: goto st14;
case 32: goto st13;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr14;
goto st0;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
if ( (*p) == 10 )
goto st15;
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
switch( (*p) ) {
case 9: goto st16;
case 32: goto st16;
}
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 9: goto st16;
case 32: goto st16;
}
if ( 48 <= (*p) && (*p) <= 57 )
goto tr14;
goto st0;
tr14:
/* #line 50 "tsip_parser_header_Min_Expires.rl" */
{
TSK_DEBUG_INFO("MIN_EXPIRES:TAG");
tag_start = p;
}
break;
case 1:
/* #line 56 "tsip_parser_header_Min_Expires.rl" */
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
/* #line 254 "../source/headers/tsip_header_Min_Expires.c" */
if ( (*p) == 13 )
goto tr17;
if ( 48 <= (*p) && (*p) <= 57 )
goto st17;
goto st0;
tr17:
/* #line 55 "tsip_parser_header_Min_Expires.rl" */
{
PARSER_SET_INTEGER(hdr_minE->value);
TSK_DEBUG_INFO("MIN_EXPIRES:PARSE_VALUE");
}
break;
case 2:
/* #line 62 "tsip_parser_header_Min_Expires.rl" */
goto st18;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
/* #line 270 "../source/headers/tsip_header_Min_Expires.c" */
if ( (*p) == 10 )
goto tr19;
goto st0;
tr19:
/* #line 60 "tsip_parser_header_Min_Expires.rl" */
{
TSK_DEBUG_INFO("MIN_EXPIRES:EOB");
}
break;
/* #line 246 "../source/headers/tsip_header_Min_Expires.c" */
}
goto st19;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
/* #line 283 "../source/headers/tsip_header_Min_Expires.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 100 "tsip_parser_header_Min_Expires.rl" */
/* #line 97 "tsip_parser_header_Min_Expires.rl" */
if( cs <
/* #line 262 "../source/headers/tsip_header_Min_Expires.c" */
/* #line 312 "../source/headers/tsip_header_Min_Expires.c" */
19
/* #line 101 "tsip_parser_header_Min_Expires.rl" */
/* #line 98 "tsip_parser_header_Min_Expires.rl" */
)
{
TSIP_HEADER_MIN_EXPIRES_SAFE_FREE(hdr_minE);

View File

@ -53,7 +53,7 @@
* Ragel state machine.
*/
/* #line 80 "tsip_parser_header_P_Access_Network_Info.rl" */
/* #line 78 "tsip_parser_header_P_Access_Network_Info.rl" */
int tsip_header_P_Access_Network_Info_tostring(const void* header, tsk_buffer_t* output)
@ -83,75 +83,6 @@ tsip_header_P_Access_Network_Info_t *tsip_header_P_Access_Network_Info_parse(con
/* #line 86 "../source/headers/tsip_header_P_Access_Network_Info.c" */
static const char _tsip_machine_parser_header_P_Access_Network_Info_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_key_offsets[] = {
0, 0, 2, 3, 5, 7, 9, 11,
13, 15, 16, 18, 20, 22, 24, 26,
28, 30, 31, 33, 35, 37, 39, 42,
45, 46, 47
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_trans_keys[] = {
80, 112, 45, 65, 97, 67, 99, 67,
99, 69, 101, 83, 115, 83, 115, 45,
78, 110, 69, 101, 84, 116, 87, 119,
79, 111, 82, 114, 75, 107, 45, 73,
105, 78, 110, 70, 102, 79, 111, 9,
32, 58, 9, 13, 32, 13, 10, 0
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_single_lengths[] = {
0, 2, 1, 2, 2, 2, 2, 2,
2, 1, 2, 2, 2, 2, 2, 2,
2, 1, 2, 2, 2, 2, 3, 3,
1, 1, 0
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_index_offsets[] = {
0, 0, 3, 5, 8, 11, 14, 17,
20, 23, 25, 28, 31, 34, 37, 40,
43, 46, 48, 51, 54, 57, 60, 64,
68, 70, 72
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_indicies[] = {
0, 0, 1, 2, 1, 3, 3, 1,
4, 4, 1, 5, 5, 1, 6, 6,
1, 7, 7, 1, 8, 8, 1, 9,
1, 10, 10, 1, 11, 11, 1, 12,
12, 1, 13, 13, 1, 14, 14, 1,
15, 15, 1, 16, 16, 1, 17, 1,
18, 18, 1, 19, 19, 1, 20, 20,
1, 21, 21, 1, 21, 21, 22, 1,
24, 25, 24, 23, 27, 26, 28, 1,
1, 0
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24,
23, 25, 24, 25, 26
};
static const char _tsip_machine_parser_header_P_Access_Network_Info_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,
1, 7, 0, 3, 5
};
static const int tsip_machine_parser_header_P_Access_Network_Info_start = 1;
static const int tsip_machine_parser_header_P_Access_Network_Info_first_final = 26;
static const int tsip_machine_parser_header_P_Access_Network_Info_error = 0;
@ -159,127 +90,317 @@ static const int tsip_machine_parser_header_P_Access_Network_Info_error = 0;
static const int tsip_machine_parser_header_P_Access_Network_Info_en_main = 1;
/* #line 108 "tsip_parser_header_P_Access_Network_Info.rl" */
/* #line 106 "tsip_parser_header_P_Access_Network_Info.rl" */
/* #line 165 "../source/headers/tsip_header_P_Access_Network_Info.c" */
/* #line 96 "../source/headers/tsip_header_P_Access_Network_Info.c" */
{
cs = tsip_machine_parser_header_P_Access_Network_Info_start;
}
/* #line 109 "tsip_parser_header_P_Access_Network_Info.rl" */
/* #line 107 "tsip_parser_header_P_Access_Network_Info.rl" */
/* #line 172 "../source/headers/tsip_header_P_Access_Network_Info.c" */
/* #line 103 "../source/headers/tsip_header_P_Access_Network_Info.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_P_Access_Network_Info_trans_keys + _tsip_machine_parser_header_P_Access_Network_Info_key_offsets[cs];
_trans = _tsip_machine_parser_header_P_Access_Network_Info_index_offsets[cs];
_klen = _tsip_machine_parser_header_P_Access_Network_Info_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_P_Access_Network_Info_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_P_Access_Network_Info_indicies[_trans];
cs = _tsip_machine_parser_header_P_Access_Network_Info_trans_targs[_trans];
if ( _tsip_machine_parser_header_P_Access_Network_Info_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_P_Access_Network_Info_actions + _tsip_machine_parser_header_P_Access_Network_Info_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 80: goto st2;
case 112: goto st2;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
if ( (*p) == 45 )
goto st3;
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 65: goto st4;
case 97: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 67: goto st5;
case 99: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 67: goto st6;
case 99: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 69: goto st7;
case 101: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 83: goto st8;
case 115: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 83: goto st9;
case 115: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
if ( (*p) == 45 )
goto st10;
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
switch( (*p) ) {
case 78: goto st11;
case 110: goto st11;
}
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 69: goto st12;
case 101: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 84: goto st13;
case 116: goto st13;
}
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 87: goto st14;
case 119: goto st14;
}
goto st0;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
switch( (*p) ) {
case 79: goto st15;
case 111: goto st15;
}
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
switch( (*p) ) {
case 82: goto st16;
case 114: goto st16;
}
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 75: goto st17;
case 107: goto st17;
}
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
if ( (*p) == 45 )
goto st18;
goto st0;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
switch( (*p) ) {
case 73: goto st19;
case 105: goto st19;
}
goto st0;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
switch( (*p) ) {
case 78: goto st20;
case 110: goto st20;
}
goto st0;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
switch( (*p) ) {
case 70: goto st21;
case 102: goto st21;
}
goto st0;
st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
switch( (*p) ) {
case 79: goto st22;
case 111: goto st22;
}
goto st0;
st22:
if ( ++p == pe )
goto _test_eof22;
case 22:
switch( (*p) ) {
case 9: goto st22;
case 32: goto st22;
case 58: goto st23;
}
goto st0;
tr24:
/* #line 60 "tsip_parser_header_P_Access_Network_Info.rl" */
{
TSK_DEBUG_INFO("P_ACCESS_NETWORK_INFO:TAG");
tag_start = p;
}
break;
case 1:
/* #line 66 "tsip_parser_header_P_Access_Network_Info.rl" */
goto st23;
st23:
if ( ++p == pe )
goto _test_eof23;
case 23:
/* #line 312 "../source/headers/tsip_header_P_Access_Network_Info.c" */
switch( (*p) ) {
case 9: goto tr24;
case 13: goto tr25;
case 32: goto tr24;
}
goto tr23;
tr23:
/* #line 60 "tsip_parser_header_P_Access_Network_Info.rl" */
{
tag_start = p;
}
goto st24;
st24:
if ( ++p == pe )
goto _test_eof24;
case 24:
/* #line 329 "../source/headers/tsip_header_P_Access_Network_Info.c" */
if ( (*p) == 13 )
goto tr27;
goto st24;
tr25:
/* #line 60 "tsip_parser_header_P_Access_Network_Info.rl" */
{
tag_start = p;
}
/* #line 65 "tsip_parser_header_P_Access_Network_Info.rl" */
{
PARSER_SET_STRING(hdr_ani->value);
}
break;
case 2:
/* #line 71 "tsip_parser_header_P_Access_Network_Info.rl" */
goto st25;
tr27:
/* #line 65 "tsip_parser_header_P_Access_Network_Info.rl" */
{
TSK_DEBUG_INFO("P_ACCESS_NETWORK_INFO:EOB");
PARSER_SET_STRING(hdr_ani->value);
}
break;
/* #line 265 "../source/headers/tsip_header_P_Access_Network_Info.c" */
}
goto st25;
st25:
if ( ++p == pe )
goto _test_eof25;
case 25:
/* #line 353 "../source/headers/tsip_header_P_Access_Network_Info.c" */
if ( (*p) == 10 )
goto tr28;
goto st0;
tr28:
/* #line 70 "tsip_parser_header_P_Access_Network_Info.rl" */
{
}
goto st26;
st26:
if ( ++p == pe )
goto _test_eof26;
case 26:
/* #line 366 "../source/headers/tsip_header_P_Access_Network_Info.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof23: cs = 23; goto _test_eof;
_test_eof24: cs = 24; goto _test_eof;
_test_eof25: cs = 25; goto _test_eof;
_test_eof26: cs = 26; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 110 "tsip_parser_header_P_Access_Network_Info.rl" */
/* #line 108 "tsip_parser_header_P_Access_Network_Info.rl" */
if( cs <
/* #line 281 "../source/headers/tsip_header_P_Access_Network_Info.c" */
/* #line 402 "../source/headers/tsip_header_P_Access_Network_Info.c" */
26
/* #line 111 "tsip_parser_header_P_Access_Network_Info.rl" */
/* #line 109 "tsip_parser_header_P_Access_Network_Info.rl" */
)
{
TSIP_HEADER_P_ACCESS_NETWORK_INFO_SAFE_FREE(hdr_ani);

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,7 @@
* Ragel state machine.
*/
/* #line 81 "tsip_parser_header_Privacy.rl" */
/* #line 79 "tsip_parser_header_Privacy.rl" */
@ -98,202 +98,660 @@ tsip_header_Privacy_t *tsip_header_Privacy_parse(const char *data, size_t size)
/* #line 101 "../source/headers/tsip_header_Privacy.c" */
static const char _tsip_machine_parser_header_Privacy_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Privacy_key_offsets[] = {
0, 0, 2, 4, 6, 8, 10, 12,
14, 17, 34, 35, 37, 53, 69, 70,
84
};
static const char _tsip_machine_parser_header_Privacy_trans_keys[] = {
80, 112, 82, 114, 73, 105, 86, 118,
65, 97, 67, 99, 89, 121, 9, 32,
58, 9, 13, 32, 33, 37, 39, 126,
42, 43, 45, 46, 48, 57, 65, 90,
95, 122, 10, 9, 32, 9, 32, 33,
37, 39, 126, 42, 43, 45, 46, 48,
57, 65, 90, 95, 122, 13, 33, 37,
39, 59, 126, 42, 43, 45, 46, 48,
57, 65, 90, 95, 122, 10, 33, 37,
39, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 122, 0
};
static const char _tsip_machine_parser_header_Privacy_single_lengths[] = {
0, 2, 2, 2, 2, 2, 2, 2,
3, 7, 1, 2, 6, 6, 1, 4,
0
};
static const char _tsip_machine_parser_header_Privacy_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 5, 0, 0, 5, 5, 0, 5,
0
};
static const char _tsip_machine_parser_header_Privacy_index_offsets[] = {
0, 0, 3, 6, 9, 12, 15, 18,
21, 25, 38, 40, 43, 55, 67, 69,
79
};
static const char _tsip_machine_parser_header_Privacy_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 5, 5, 1, 6,
6, 1, 7, 7, 1, 7, 7, 8,
1, 8, 9, 8, 10, 10, 10, 10,
10, 10, 10, 10, 10, 1, 11, 1,
12, 12, 1, 12, 12, 10, 10, 10,
10, 10, 10, 10, 10, 10, 1, 13,
14, 14, 14, 15, 14, 14, 14, 14,
14, 14, 1, 16, 1, 10, 10, 10,
10, 10, 10, 10, 10, 10, 1, 1,
0
};
static const char _tsip_machine_parser_header_Privacy_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 13, 11, 12, 14, 13, 15,
16
};
static const char _tsip_machine_parser_header_Privacy_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 3, 0, 3,
5
};
static const int tsip_machine_parser_header_Privacy_start = 1;
static const int tsip_machine_parser_header_Privacy_first_final = 16;
static const int tsip_machine_parser_header_Privacy_first_final = 45;
static const int tsip_machine_parser_header_Privacy_error = 0;
static const int tsip_machine_parser_header_Privacy_en_main = 1;
/* #line 124 "tsip_parser_header_Privacy.rl" */
/* #line 122 "tsip_parser_header_Privacy.rl" */
/* #line 179 "../source/headers/tsip_header_Privacy.c" */
/* #line 111 "../source/headers/tsip_header_Privacy.c" */
{
cs = tsip_machine_parser_header_Privacy_start;
}
/* #line 125 "tsip_parser_header_Privacy.rl" */
/* #line 123 "tsip_parser_header_Privacy.rl" */
/* #line 186 "../source/headers/tsip_header_Privacy.c" */
/* #line 118 "../source/headers/tsip_header_Privacy.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Privacy_trans_keys + _tsip_machine_parser_header_Privacy_key_offsets[cs];
_trans = _tsip_machine_parser_header_Privacy_index_offsets[cs];
_klen = _tsip_machine_parser_header_Privacy_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Privacy_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Privacy_indicies[_trans];
cs = _tsip_machine_parser_header_Privacy_trans_targs[_trans];
if ( _tsip_machine_parser_header_Privacy_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Privacy_actions + _tsip_machine_parser_header_Privacy_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 80: goto st2;
case 112: goto st2;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 82: goto st3;
case 114: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 73: goto st4;
case 105: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 86: goto st5;
case 118: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 65: goto st6;
case 97: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 67: goto st7;
case 99: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 89: goto st8;
case 121: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 9: goto st8;
case 32: goto st8;
case 58: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 9: goto st9;
case 13: goto st10;
case 32: goto st9;
case 33: goto tr10;
case 37: goto tr10;
case 39: goto tr10;
case 67: goto tr11;
case 72: goto tr12;
case 73: goto tr13;
case 78: goto tr14;
case 83: goto tr15;
case 85: goto tr16;
case 99: goto tr11;
case 104: goto tr12;
case 105: goto tr13;
case 110: goto tr14;
case 115: goto tr15;
case 117: goto tr16;
case 126: goto tr10;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr10;
} else if ( (*p) >= 42 )
goto tr10;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr10;
} else if ( (*p) >= 65 )
goto tr10;
} else
goto tr10;
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
if ( (*p) == 10 )
goto st11;
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
case 33: goto tr10;
case 37: goto tr10;
case 39: goto tr10;
case 67: goto tr11;
case 72: goto tr12;
case 73: goto tr13;
case 78: goto tr14;
case 83: goto tr15;
case 85: goto tr16;
case 99: goto tr11;
case 104: goto tr12;
case 105: goto tr13;
case 110: goto tr14;
case 115: goto tr15;
case 117: goto tr16;
case 126: goto tr10;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr10;
} else if ( (*p) >= 42 )
goto tr10;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr10;
} else if ( (*p) >= 65 )
goto tr10;
} else
goto tr10;
goto st0;
tr10:
/* #line 60 "tsip_parser_header_Privacy.rl" */
{
TSK_DEBUG_INFO("PRIVACY:TAG");
tag_start = p;
}
break;
case 1:
/* #line 66 "tsip_parser_header_Privacy.rl" */
goto st13;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
/* #line 302 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 13: goto tr19;
case 33: goto st13;
case 37: goto st13;
case 39: goto st13;
case 59: goto tr21;
case 126: goto st13;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st13;
} else if ( (*p) >= 42 )
goto st13;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto st13;
} else if ( (*p) >= 65 )
goto st13;
} else
goto st13;
goto st0;
tr19:
/* #line 65 "tsip_parser_header_Privacy.rl" */
{
PARSER_ADD_STRING(hdr_privacy->values);
}
break;
case 2:
/* #line 71 "tsip_parser_header_Privacy.rl" */
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 336 "../source/headers/tsip_header_Privacy.c" */
if ( (*p) == 10 )
goto tr22;
goto st0;
tr22:
/* #line 70 "tsip_parser_header_Privacy.rl" */
{
TSK_DEBUG_INFO("PRIVACY:EOB");
}
break;
/* #line 279 "../source/headers/tsip_header_Privacy.c" */
}
goto st45;
st45:
if ( ++p == pe )
goto _test_eof45;
case 45:
/* #line 349 "../source/headers/tsip_header_Privacy.c" */
goto st0;
tr21:
/* #line 65 "tsip_parser_header_Privacy.rl" */
{
PARSER_ADD_STRING(hdr_privacy->values);
}
goto st15;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
/* #line 361 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 33: goto tr10;
case 37: goto tr10;
case 39: goto tr10;
case 67: goto tr11;
case 72: goto tr12;
case 73: goto tr13;
case 78: goto tr14;
case 83: goto tr15;
case 85: goto tr16;
case 99: goto tr11;
case 104: goto tr12;
case 105: goto tr13;
case 110: goto tr14;
case 115: goto tr15;
case 117: goto tr16;
case 126: goto tr10;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr10;
} else if ( (*p) >= 42 )
goto tr10;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr10;
} else if ( (*p) >= 65 )
goto tr10;
} else
goto tr10;
goto st0;
tr11:
/* #line 60 "tsip_parser_header_Privacy.rl" */
{
tag_start = p;
}
goto st16;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
/* #line 405 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 82: goto st17;
case 114: goto st17;
}
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
switch( (*p) ) {
case 73: goto st18;
case 105: goto st18;
}
goto st0;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
switch( (*p) ) {
case 84: goto st19;
case 116: goto st19;
}
goto st0;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
switch( (*p) ) {
case 73: goto st20;
case 105: goto st20;
}
goto st0;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
switch( (*p) ) {
case 67: goto st21;
case 99: goto st21;
}
goto st0;
st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
switch( (*p) ) {
case 65: goto st22;
case 97: goto st22;
}
goto st0;
st22:
if ( ++p == pe )
goto _test_eof22;
case 22:
switch( (*p) ) {
case 76: goto st23;
case 108: goto st23;
}
goto st0;
st23:
if ( ++p == pe )
goto _test_eof23;
case 23:
switch( (*p) ) {
case 13: goto tr19;
case 59: goto tr21;
}
goto st0;
tr12:
/* #line 60 "tsip_parser_header_Privacy.rl" */
{
tag_start = p;
}
goto st24;
st24:
if ( ++p == pe )
goto _test_eof24;
case 24:
/* #line 484 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 69: goto st25;
case 73: goto st29;
case 101: goto st25;
case 105: goto st29;
}
goto st0;
st25:
if ( ++p == pe )
goto _test_eof25;
case 25:
switch( (*p) ) {
case 65: goto st26;
case 97: goto st26;
}
goto st0;
st26:
if ( ++p == pe )
goto _test_eof26;
case 26:
switch( (*p) ) {
case 68: goto st27;
case 100: goto st27;
}
goto st0;
st27:
if ( ++p == pe )
goto _test_eof27;
case 27:
switch( (*p) ) {
case 69: goto st28;
case 101: goto st28;
}
goto st0;
st28:
if ( ++p == pe )
goto _test_eof28;
case 28:
switch( (*p) ) {
case 82: goto st23;
case 114: goto st23;
}
goto st0;
st29:
if ( ++p == pe )
goto _test_eof29;
case 29:
switch( (*p) ) {
case 83: goto st30;
case 115: goto st30;
}
goto st0;
st30:
if ( ++p == pe )
goto _test_eof30;
case 30:
switch( (*p) ) {
case 84: goto st31;
case 116: goto st31;
}
goto st0;
st31:
if ( ++p == pe )
goto _test_eof31;
case 31:
switch( (*p) ) {
case 79: goto st32;
case 111: goto st32;
}
goto st0;
st32:
if ( ++p == pe )
goto _test_eof32;
case 32:
switch( (*p) ) {
case 82: goto st33;
case 114: goto st33;
}
goto st0;
st33:
if ( ++p == pe )
goto _test_eof33;
case 33:
switch( (*p) ) {
case 89: goto st23;
case 121: goto st23;
}
goto st0;
tr13:
/* #line 60 "tsip_parser_header_Privacy.rl" */
{
tag_start = p;
}
goto st34;
st34:
if ( ++p == pe )
goto _test_eof34;
case 34:
/* #line 583 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 68: goto st23;
case 100: goto st23;
}
goto st0;
tr14:
/* #line 60 "tsip_parser_header_Privacy.rl" */
{
tag_start = p;
}
goto st35;
st35:
if ( ++p == pe )
goto _test_eof35;
case 35:
/* #line 599 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 79: goto st36;
case 111: goto st36;
}
goto st0;
st36:
if ( ++p == pe )
goto _test_eof36;
case 36:
switch( (*p) ) {
case 78: goto st37;
case 110: goto st37;
}
goto st0;
st37:
if ( ++p == pe )
goto _test_eof37;
case 37:
switch( (*p) ) {
case 69: goto st23;
case 101: goto st23;
}
goto st0;
tr15:
/* #line 60 "tsip_parser_header_Privacy.rl" */
{
tag_start = p;
}
goto st38;
st38:
if ( ++p == pe )
goto _test_eof38;
case 38:
/* #line 633 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 69: goto st39;
case 101: goto st39;
}
goto st0;
st39:
if ( ++p == pe )
goto _test_eof39;
case 39:
switch( (*p) ) {
case 83: goto st40;
case 115: goto st40;
}
goto st0;
st40:
if ( ++p == pe )
goto _test_eof40;
case 40:
switch( (*p) ) {
case 83: goto st41;
case 115: goto st41;
}
goto st0;
st41:
if ( ++p == pe )
goto _test_eof41;
case 41:
switch( (*p) ) {
case 73: goto st42;
case 105: goto st42;
}
goto st0;
st42:
if ( ++p == pe )
goto _test_eof42;
case 42:
switch( (*p) ) {
case 79: goto st43;
case 111: goto st43;
}
goto st0;
st43:
if ( ++p == pe )
goto _test_eof43;
case 43:
switch( (*p) ) {
case 78: goto st23;
case 110: goto st23;
}
goto st0;
tr16:
/* #line 60 "tsip_parser_header_Privacy.rl" */
{
tag_start = p;
}
goto st44;
st44:
if ( ++p == pe )
goto _test_eof44;
case 44:
/* #line 694 "../source/headers/tsip_header_Privacy.c" */
switch( (*p) ) {
case 83: goto st27;
case 115: goto st27;
}
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof45: cs = 45; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof23: cs = 23; goto _test_eof;
_test_eof24: cs = 24; goto _test_eof;
_test_eof25: cs = 25; goto _test_eof;
_test_eof26: cs = 26; goto _test_eof;
_test_eof27: cs = 27; goto _test_eof;
_test_eof28: cs = 28; goto _test_eof;
_test_eof29: cs = 29; goto _test_eof;
_test_eof30: cs = 30; goto _test_eof;
_test_eof31: cs = 31; goto _test_eof;
_test_eof32: cs = 32; goto _test_eof;
_test_eof33: cs = 33; goto _test_eof;
_test_eof34: cs = 34; goto _test_eof;
_test_eof35: cs = 35; goto _test_eof;
_test_eof36: cs = 36; goto _test_eof;
_test_eof37: cs = 37; goto _test_eof;
_test_eof38: cs = 38; goto _test_eof;
_test_eof39: cs = 39; goto _test_eof;
_test_eof40: cs = 40; goto _test_eof;
_test_eof41: cs = 41; goto _test_eof;
_test_eof42: cs = 42; goto _test_eof;
_test_eof43: cs = 43; goto _test_eof;
_test_eof44: cs = 44; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 126 "tsip_parser_header_Privacy.rl" */
/* #line 124 "tsip_parser_header_Privacy.rl" */
if( cs <
/* #line 295 "../source/headers/tsip_header_Privacy.c" */
16
/* #line 127 "tsip_parser_header_Privacy.rl" */
/* #line 753 "../source/headers/tsip_header_Privacy.c" */
45
/* #line 125 "tsip_parser_header_Privacy.rl" */
)
{
TSIP_HEADER_PRIVACY_SAFE_FREE(hdr_privacy);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@
* Ragel state machine.
*/
/* #line 72 "tsip_parser_header_Require.rl" */
/* #line 70 "tsip_parser_header_Require.rl" */
int tsip_header_Require_tostring(const void* header, tsk_buffer_t* output)
@ -88,74 +88,6 @@ tsip_header_Require_t *tsip_header_Require_parse(const char *data, size_t size)
/* #line 91 "../source/headers/tsip_header_Require.c" */
static const char _tsip_machine_parser_header_Require_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Require_key_offsets[] = {
0, 0, 2, 4, 6, 8, 10, 12,
14, 17, 34, 35, 37, 53, 69, 73,
74, 76, 79, 80
};
static const char _tsip_machine_parser_header_Require_trans_keys[] = {
82, 114, 69, 101, 81, 113, 85, 117,
73, 105, 82, 114, 69, 101, 9, 32,
58, 9, 13, 32, 33, 37, 39, 126,
42, 43, 45, 46, 48, 57, 65, 90,
95, 122, 10, 9, 32, 9, 32, 33,
37, 39, 126, 42, 43, 45, 46, 48,
57, 65, 90, 95, 122, 9, 13, 32,
33, 37, 39, 44, 126, 42, 46, 48,
57, 65, 90, 95, 122, 9, 13, 32,
44, 10, 9, 32, 9, 32, 44, 10,
0
};
static const char _tsip_machine_parser_header_Require_single_lengths[] = {
0, 2, 2, 2, 2, 2, 2, 2,
3, 7, 1, 2, 6, 8, 4, 1,
2, 3, 1, 0
};
static const char _tsip_machine_parser_header_Require_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 5, 0, 0, 5, 4, 0, 0,
0, 0, 0, 0
};
static const char _tsip_machine_parser_header_Require_index_offsets[] = {
0, 0, 3, 6, 9, 12, 15, 18,
21, 25, 38, 40, 43, 55, 68, 73,
75, 78, 82, 84
};
static const char _tsip_machine_parser_header_Require_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 5, 5, 1, 6,
6, 1, 7, 7, 1, 7, 7, 8,
1, 8, 9, 8, 10, 10, 10, 10,
10, 10, 10, 10, 10, 1, 11, 1,
12, 12, 1, 12, 12, 10, 10, 10,
10, 10, 10, 10, 10, 10, 1, 13,
14, 13, 15, 15, 15, 16, 15, 15,
15, 15, 15, 1, 17, 18, 17, 8,
1, 19, 1, 20, 20, 1, 20, 20,
8, 1, 21, 1, 1, 0
};
static const char _tsip_machine_parser_header_Require_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 13, 11, 12, 14, 18, 13,
9, 14, 15, 16, 17, 19
};
static const char _tsip_machine_parser_header_Require_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 3, 3, 0,
3, 0, 0, 0, 0, 5
};
static const int tsip_machine_parser_header_Require_start = 1;
static const int tsip_machine_parser_header_Require_first_final = 19;
static const int tsip_machine_parser_header_Require_error = 0;
@ -163,127 +95,304 @@ static const int tsip_machine_parser_header_Require_error = 0;
static const int tsip_machine_parser_header_Require_en_main = 1;
/* #line 113 "tsip_parser_header_Require.rl" */
/* #line 111 "tsip_parser_header_Require.rl" */
/* #line 169 "../source/headers/tsip_header_Require.c" */
/* #line 101 "../source/headers/tsip_header_Require.c" */
{
cs = tsip_machine_parser_header_Require_start;
}
/* #line 114 "tsip_parser_header_Require.rl" */
/* #line 112 "tsip_parser_header_Require.rl" */
/* #line 176 "../source/headers/tsip_header_Require.c" */
/* #line 108 "../source/headers/tsip_header_Require.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Require_trans_keys + _tsip_machine_parser_header_Require_key_offsets[cs];
_trans = _tsip_machine_parser_header_Require_index_offsets[cs];
_klen = _tsip_machine_parser_header_Require_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Require_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Require_indicies[_trans];
cs = _tsip_machine_parser_header_Require_trans_targs[_trans];
if ( _tsip_machine_parser_header_Require_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Require_actions + _tsip_machine_parser_header_Require_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
/* #line 52 "tsip_parser_header_Require.rl" */
{
TSK_DEBUG_INFO("REQUIRE:TAG");
tag_start = p;
case 1:
switch( (*p) ) {
case 82: goto st2;
case 114: goto st2;
}
break;
case 1:
/* #line 58 "tsip_parser_header_Require.rl" */
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 69: goto st3;
case 101: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 81: goto st4;
case 113: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 85: goto st5;
case 117: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
switch( (*p) ) {
case 73: goto st6;
case 105: goto st6;
}
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 82: goto st7;
case 114: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 69: goto st8;
case 101: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 9: goto st8;
case 32: goto st8;
case 58: goto st9;
}
goto st0;
tr16:
/* #line 57 "tsip_parser_header_Require.rl" */
{
PARSER_ADD_STRING(hdr_require->options);
}
break;
case 2:
/* #line 63 "tsip_parser_header_Require.rl" */
goto st9;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
/* #line 197 "../source/headers/tsip_header_Require.c" */
switch( (*p) ) {
case 9: goto st9;
case 13: goto st10;
case 32: goto st9;
case 33: goto tr10;
case 37: goto tr10;
case 39: goto tr10;
case 126: goto tr10;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr10;
} else if ( (*p) >= 42 )
goto tr10;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr10;
} else if ( (*p) >= 65 )
goto tr10;
} else
goto tr10;
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
if ( (*p) == 10 )
goto st11;
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
}
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 9: goto st12;
case 32: goto st12;
case 33: goto tr10;
case 37: goto tr10;
case 39: goto tr10;
case 126: goto tr10;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr10;
} else if ( (*p) >= 42 )
goto tr10;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr10;
} else if ( (*p) >= 65 )
goto tr10;
} else
goto tr10;
goto st0;
tr10:
/* #line 52 "tsip_parser_header_Require.rl" */
{
TSK_DEBUG_INFO("REQUIRE:EOB");
tag_start = p;
}
break;
/* #line 269 "../source/headers/tsip_header_Require.c" */
}
goto st13;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
/* #line 275 "../source/headers/tsip_header_Require.c" */
switch( (*p) ) {
case 9: goto tr13;
case 13: goto tr14;
case 32: goto tr13;
case 33: goto st13;
case 37: goto st13;
case 39: goto st13;
case 44: goto tr16;
case 126: goto st13;
}
if ( (*p) < 48 ) {
if ( 42 <= (*p) && (*p) <= 46 )
goto st13;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto st13;
} else if ( (*p) >= 65 )
goto st13;
} else
goto st13;
goto st0;
tr13:
/* #line 57 "tsip_parser_header_Require.rl" */
{
PARSER_ADD_STRING(hdr_require->options);
}
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 308 "../source/headers/tsip_header_Require.c" */
switch( (*p) ) {
case 9: goto st14;
case 13: goto st15;
case 32: goto st14;
case 44: goto st9;
}
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
if ( (*p) == 10 )
goto st16;
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
}
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
switch( (*p) ) {
case 9: goto st17;
case 32: goto st17;
case 44: goto st9;
}
goto st0;
tr14:
/* #line 57 "tsip_parser_header_Require.rl" */
{
PARSER_ADD_STRING(hdr_require->options);
}
goto st18;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
/* #line 352 "../source/headers/tsip_header_Require.c" */
if ( (*p) == 10 )
goto tr21;
goto st0;
tr21:
/* #line 62 "tsip_parser_header_Require.rl" */
{
}
goto st19;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
/* #line 365 "../source/headers/tsip_header_Require.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 115 "tsip_parser_header_Require.rl" */
/* #line 113 "tsip_parser_header_Require.rl" */
if( cs <
/* #line 285 "../source/headers/tsip_header_Require.c" */
/* #line 394 "../source/headers/tsip_header_Require.c" */
19
/* #line 116 "tsip_parser_header_Require.rl" */
/* #line 114 "tsip_parser_header_Require.rl" */
)
{
TSIP_HEADER_REQUIRE_SAFE_FREE(hdr_require);

View File

@ -45,7 +45,7 @@
* Ragel state machine.
*/
/* #line 72 "tsip_parser_header_Supported.rl" */
/* #line 70 "tsip_parser_header_Supported.rl" */
int tsip_header_Supported_tostring(const void* header, tsk_buffer_t* output)
@ -88,81 +88,6 @@ tsip_header_Supported_t *tsip_header_Supported_parse(const char *data, size_t si
/* #line 91 "../source/headers/tsip_header_Supported.c" */
static const char _tsip_machine_parser_header_Supported_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsip_machine_parser_header_Supported_key_offsets[] = {
0, 0, 4, 7, 24, 25, 41, 45,
46, 48, 51, 68, 69, 71, 87, 89,
91, 93, 95, 97, 99, 101, 103
};
static const char _tsip_machine_parser_header_Supported_trans_keys[] = {
75, 83, 107, 115, 9, 32, 58, 9,
13, 32, 33, 37, 39, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
10, 9, 13, 32, 33, 37, 39, 44,
126, 42, 46, 48, 57, 65, 90, 95,
122, 9, 13, 32, 44, 10, 9, 32,
9, 32, 44, 9, 13, 32, 33, 37,
39, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 122, 10, 9, 32, 9,
32, 33, 37, 39, 126, 42, 43, 45,
46, 48, 57, 65, 90, 95, 122, 85,
117, 80, 112, 80, 112, 79, 111, 82,
114, 84, 116, 69, 101, 68, 100, 0
};
static const char _tsip_machine_parser_header_Supported_single_lengths[] = {
0, 4, 3, 7, 1, 8, 4, 1,
2, 3, 7, 1, 2, 6, 2, 2,
2, 2, 2, 2, 2, 2, 0
};
static const char _tsip_machine_parser_header_Supported_range_lengths[] = {
0, 0, 0, 5, 0, 4, 0, 0,
0, 0, 5, 0, 0, 5, 0, 0,
0, 0, 0, 0, 0, 0, 0
};
static const unsigned char _tsip_machine_parser_header_Supported_index_offsets[] = {
0, 0, 5, 9, 22, 24, 37, 42,
44, 47, 51, 64, 66, 69, 81, 84,
87, 90, 93, 96, 99, 102, 105
};
static const char _tsip_machine_parser_header_Supported_indicies[] = {
0, 2, 0, 2, 1, 0, 0, 3,
1, 3, 4, 3, 5, 5, 5, 5,
5, 5, 5, 5, 5, 1, 6, 1,
7, 8, 7, 9, 9, 9, 10, 9,
9, 9, 9, 9, 1, 11, 12, 11,
13, 1, 14, 1, 15, 15, 1, 15,
15, 13, 1, 13, 16, 13, 5, 5,
5, 5, 5, 5, 5, 5, 5, 1,
17, 1, 18, 18, 1, 18, 18, 5,
5, 5, 5, 5, 5, 5, 5, 5,
1, 19, 19, 1, 20, 20, 1, 21,
21, 1, 22, 22, 1, 23, 23, 1,
24, 24, 1, 25, 25, 1, 0, 0,
1, 1, 0
};
static const char _tsip_machine_parser_header_Supported_trans_targs[] = {
2, 0, 14, 3, 4, 5, 22, 6,
4, 5, 10, 6, 7, 10, 8, 9,
11, 12, 13, 15, 16, 17, 18, 19,
20, 21
};
static const char _tsip_machine_parser_header_Supported_trans_actions[] = {
0, 0, 0, 0, 0, 1, 5, 3,
3, 0, 3, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0
};
static const int tsip_machine_parser_header_Supported_start = 1;
static const int tsip_machine_parser_header_Supported_first_final = 22;
static const int tsip_machine_parser_header_Supported_error = 0;
@ -170,127 +95,355 @@ static const int tsip_machine_parser_header_Supported_error = 0;
static const int tsip_machine_parser_header_Supported_en_main = 1;
/* #line 113 "tsip_parser_header_Supported.rl" */
/* #line 111 "tsip_parser_header_Supported.rl" */
/* #line 176 "../source/headers/tsip_header_Supported.c" */
/* #line 101 "../source/headers/tsip_header_Supported.c" */
{
cs = tsip_machine_parser_header_Supported_start;
}
/* #line 114 "tsip_parser_header_Supported.rl" */
/* #line 112 "tsip_parser_header_Supported.rl" */
/* #line 183 "../source/headers/tsip_header_Supported.c" */
/* #line 108 "../source/headers/tsip_header_Supported.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_Supported_trans_keys + _tsip_machine_parser_header_Supported_key_offsets[cs];
_trans = _tsip_machine_parser_header_Supported_index_offsets[cs];
_klen = _tsip_machine_parser_header_Supported_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_Supported_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_Supported_indicies[_trans];
cs = _tsip_machine_parser_header_Supported_trans_targs[_trans];
if ( _tsip_machine_parser_header_Supported_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Supported_actions + _tsip_machine_parser_header_Supported_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
/* #line 52 "tsip_parser_header_Supported.rl" */
{
TSK_DEBUG_INFO("SUPPORTED:TAG");
tag_start = p;
case 1:
switch( (*p) ) {
case 75: goto st2;
case 83: goto st14;
case 107: goto st2;
case 115: goto st14;
}
break;
case 1:
/* #line 58 "tsip_parser_header_Supported.rl" */
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 9: goto st2;
case 32: goto st2;
case 58: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 9: goto st3;
case 13: goto st4;
case 32: goto st3;
case 33: goto tr5;
case 37: goto tr5;
case 39: goto tr5;
case 126: goto tr5;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr5;
} else if ( (*p) >= 42 )
goto tr5;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr5;
} else if ( (*p) >= 65 )
goto tr5;
} else
goto tr5;
goto st0;
tr8:
/* #line 57 "tsip_parser_header_Supported.rl" */
{
PARSER_ADD_STRING(hdr_supported->options);
}
break;
case 2:
/* #line 63 "tsip_parser_header_Supported.rl" */
goto st4;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
/* #line 173 "../source/headers/tsip_header_Supported.c" */
if ( (*p) == 10 )
goto tr6;
goto st0;
tr6:
/* #line 62 "tsip_parser_header_Supported.rl" */
{
TSK_DEBUG_INFO("SUPPORTED:EOB");
}
break;
/* #line 276 "../source/headers/tsip_header_Supported.c" */
}
goto st22;
st22:
if ( ++p == pe )
goto _test_eof22;
case 22:
/* #line 186 "../source/headers/tsip_header_Supported.c" */
goto st0;
tr5:
/* #line 52 "tsip_parser_header_Supported.rl" */
{
tag_start = p;
}
goto st5;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
/* #line 198 "../source/headers/tsip_header_Supported.c" */
switch( (*p) ) {
case 9: goto tr7;
case 13: goto tr8;
case 32: goto tr7;
case 33: goto st5;
case 37: goto st5;
case 39: goto st5;
case 44: goto tr10;
case 126: goto st5;
}
if ( (*p) < 48 ) {
if ( 42 <= (*p) && (*p) <= 46 )
goto st5;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto st5;
} else if ( (*p) >= 65 )
goto st5;
} else
goto st5;
goto st0;
tr7:
/* #line 57 "tsip_parser_header_Supported.rl" */
{
PARSER_ADD_STRING(hdr_supported->options);
}
goto st6;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
/* #line 231 "../source/headers/tsip_header_Supported.c" */
switch( (*p) ) {
case 9: goto st6;
case 13: goto st7;
case 32: goto st6;
case 44: goto st10;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
if ( (*p) == 10 )
goto st8;
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 9: goto st9;
case 32: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 9: goto st9;
case 32: goto st9;
case 44: goto st10;
}
goto st0;
tr10:
/* #line 57 "tsip_parser_header_Supported.rl" */
{
PARSER_ADD_STRING(hdr_supported->options);
}
goto st10;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
/* #line 275 "../source/headers/tsip_header_Supported.c" */
switch( (*p) ) {
case 9: goto st10;
case 13: goto st11;
case 32: goto st10;
case 33: goto tr5;
case 37: goto tr5;
case 39: goto tr5;
case 126: goto tr5;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr5;
} else if ( (*p) >= 42 )
goto tr5;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr5;
} else if ( (*p) >= 65 )
goto tr5;
} else
goto tr5;
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
if ( (*p) == 10 )
goto st12;
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 9: goto st13;
case 32: goto st13;
}
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 9: goto st13;
case 32: goto st13;
case 33: goto tr5;
case 37: goto tr5;
case 39: goto tr5;
case 126: goto tr5;
}
if ( (*p) < 48 ) {
if ( (*p) > 43 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr5;
} else if ( (*p) >= 42 )
goto tr5;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 95 <= (*p) && (*p) <= 122 )
goto tr5;
} else if ( (*p) >= 65 )
goto tr5;
} else
goto tr5;
goto st0;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
switch( (*p) ) {
case 85: goto st15;
case 117: goto st15;
}
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
switch( (*p) ) {
case 80: goto st16;
case 112: goto st16;
}
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 80: goto st17;
case 112: goto st17;
}
goto st0;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
switch( (*p) ) {
case 79: goto st18;
case 111: goto st18;
}
goto st0;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
switch( (*p) ) {
case 82: goto st19;
case 114: goto st19;
}
goto st0;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
switch( (*p) ) {
case 84: goto st20;
case 116: goto st20;
}
goto st0;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
switch( (*p) ) {
case 69: goto st21;
case 101: goto st21;
}
goto st0;
st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
switch( (*p) ) {
case 68: goto st2;
case 100: goto st2;
}
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 115 "tsip_parser_header_Supported.rl" */
/* #line 113 "tsip_parser_header_Supported.rl" */
if( cs <
/* #line 292 "../source/headers/tsip_header_Supported.c" */
/* #line 445 "../source/headers/tsip_header_Supported.c" */
22
/* #line 116 "tsip_parser_header_Supported.rl" */
/* #line 114 "tsip_parser_header_Supported.rl" */
)
{
TSIP_HEADER_SUPPORTED_SAFE_FREE(hdr_supported);

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@
* Ragel state machine.
*/
/* #line 73 "tsip_parser_header_User_Agent.rl" */
/* #line 70 "tsip_parser_header_User_Agent.rl" */
int tsip_header_User_Agent_tostring(const void* header, tsk_buffer_t* output)
@ -75,59 +75,6 @@ tsip_header_User_Agent_t *tsip_header_User_Agent_parse(const char *data, size_t
/* #line 78 "../source/headers/tsip_header_User_Agent.c" */
static const char _tsip_machine_parser_header_User_Agent_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsip_machine_parser_header_User_Agent_key_offsets[] = {
0, 0, 2, 4, 6, 8, 9, 11,
13, 15, 17, 19, 22, 25, 26, 27
};
static const char _tsip_machine_parser_header_User_Agent_trans_keys[] = {
85, 117, 83, 115, 69, 101, 82, 114,
45, 65, 97, 71, 103, 69, 101, 78,
110, 84, 116, 9, 32, 58, 9, 13,
32, 13, 10, 0
};
static const char _tsip_machine_parser_header_User_Agent_single_lengths[] = {
0, 2, 2, 2, 2, 1, 2, 2,
2, 2, 2, 3, 3, 1, 1, 0
};
static const char _tsip_machine_parser_header_User_Agent_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
static const char _tsip_machine_parser_header_User_Agent_index_offsets[] = {
0, 0, 3, 6, 9, 12, 14, 17,
20, 23, 26, 29, 33, 37, 39, 41
};
static const char _tsip_machine_parser_header_User_Agent_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 5, 1, 6, 6,
1, 7, 7, 1, 8, 8, 1, 9,
9, 1, 10, 10, 1, 10, 10, 11,
1, 13, 14, 13, 12, 16, 15, 17,
1, 1, 0
};
static const char _tsip_machine_parser_header_User_Agent_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 12, 14, 13,
14, 15
};
static const char _tsip_machine_parser_header_User_Agent_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 7, 0,
3, 5
};
static const int tsip_machine_parser_header_User_Agent_start = 1;
static const int tsip_machine_parser_header_User_Agent_first_final = 15;
static const int tsip_machine_parser_header_User_Agent_error = 0;
@ -135,128 +82,211 @@ static const int tsip_machine_parser_header_User_Agent_error = 0;
static const int tsip_machine_parser_header_User_Agent_en_main = 1;
/* #line 101 "tsip_parser_header_User_Agent.rl" */
/* #line 98 "tsip_parser_header_User_Agent.rl" */
/* #line 141 "../source/headers/tsip_header_User_Agent.c" */
/* #line 88 "../source/headers/tsip_header_User_Agent.c" */
{
cs = tsip_machine_parser_header_User_Agent_start;
}
/* #line 102 "tsip_parser_header_User_Agent.rl" */
/* #line 99 "tsip_parser_header_User_Agent.rl" */
/* #line 148 "../source/headers/tsip_header_User_Agent.c" */
/* #line 95 "../source/headers/tsip_header_User_Agent.c" */
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const char *_keys;
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
_keys = _tsip_machine_parser_header_User_Agent_trans_keys + _tsip_machine_parser_header_User_Agent_key_offsets[cs];
_trans = _tsip_machine_parser_header_User_Agent_index_offsets[cs];
_klen = _tsip_machine_parser_header_User_Agent_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _tsip_machine_parser_header_User_Agent_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
const char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _tsip_machine_parser_header_User_Agent_indicies[_trans];
cs = _tsip_machine_parser_header_User_Agent_trans_targs[_trans];
if ( _tsip_machine_parser_header_User_Agent_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_User_Agent_actions + _tsip_machine_parser_header_User_Agent_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
switch ( cs )
{
switch ( *_acts++ )
{
case 0:
case 1:
switch( (*p) ) {
case 85: goto st2;
case 117: goto st2;
}
goto st0;
st0:
cs = 0;
goto _out;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
switch( (*p) ) {
case 83: goto st3;
case 115: goto st3;
}
goto st0;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 69: goto st4;
case 101: goto st4;
}
goto st0;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
switch( (*p) ) {
case 82: goto st5;
case 114: goto st5;
}
goto st0;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
if ( (*p) == 45 )
goto st6;
goto st0;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
switch( (*p) ) {
case 65: goto st7;
case 97: goto st7;
}
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 71: goto st8;
case 103: goto st8;
}
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 69: goto st9;
case 101: goto st9;
}
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 78: goto st10;
case 110: goto st10;
}
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
switch( (*p) ) {
case 84: goto st11;
case 116: goto st11;
}
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 9: goto st11;
case 32: goto st11;
case 58: goto st12;
}
goto st0;
tr13:
/* #line 52 "tsip_parser_header_User_Agent.rl" */
{
TSK_DEBUG_INFO("USER_AGENT:TAG");
tag_start = p;
}
break;
case 1:
/* #line 58 "tsip_parser_header_User_Agent.rl" */
goto st12;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
/* #line 209 "../source/headers/tsip_header_User_Agent.c" */
switch( (*p) ) {
case 9: goto tr13;
case 13: goto tr14;
case 32: goto tr13;
}
goto tr12;
tr12:
/* #line 52 "tsip_parser_header_User_Agent.rl" */
{
tag_start = p;
}
goto st13;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
/* #line 226 "../source/headers/tsip_header_User_Agent.c" */
if ( (*p) == 13 )
goto tr16;
goto st13;
tr14:
/* #line 52 "tsip_parser_header_User_Agent.rl" */
{
tag_start = p;
}
/* #line 57 "tsip_parser_header_User_Agent.rl" */
{
PARSER_SET_STRING(hdr_user_agent->value);
TSK_DEBUG_INFO("USER_AGENT:parse_user_agent");
}
break;
case 2:
/* #line 64 "tsip_parser_header_User_Agent.rl" */
goto st14;
tr16:
/* #line 57 "tsip_parser_header_User_Agent.rl" */
{
TSK_DEBUG_INFO("USER_AGENT:EOB");
PARSER_SET_STRING(hdr_user_agent->value);
}
break;
/* #line 242 "../source/headers/tsip_header_User_Agent.c" */
}
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 250 "../source/headers/tsip_header_User_Agent.c" */
if ( (*p) == 10 )
goto tr17;
goto st0;
tr17:
/* #line 62 "tsip_parser_header_User_Agent.rl" */
{
}
goto st15;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
/* #line 263 "../source/headers/tsip_header_User_Agent.c" */
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 103 "tsip_parser_header_User_Agent.rl" */
/* #line 100 "tsip_parser_header_User_Agent.rl" */
if( cs <
/* #line 258 "../source/headers/tsip_header_User_Agent.c" */
/* #line 288 "../source/headers/tsip_header_User_Agent.c" */
15
/* #line 104 "tsip_parser_header_User_Agent.rl" */
/* #line 101 "tsip_parser_header_User_Agent.rl" */
)
{
TSIP_HEADER_USER_AGENT_SAFE_FREE(hdr_user_agent);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,502 @@
/*
* ex: set ro:
* DO NOT EDIT.
* generated by smc (http://smc.sourceforge.net/)
* from file : tsip_dialog_message.sm
*/
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_message.sm.
* @brief SIP dialog MESSAGE.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include <assert.h>
#include "tinysip/dialogs/tsip_dialog_message.h"
#include "tsk_debug.h"
#include "tinysip/smc/tsip_dialog_message_sm.h"
#define getOwner(fsm) \
(fsm)->_owner
#define POPULATE_STATE(state) \
state##_Entry, \
state##_sm_1xx, \
state##_sm_2xx, \
state##_sm_300_to_699, \
state##_sm_401_407_421_494, \
state##_sm_accept, \
state##_sm_cancel, \
state##_sm_error, \
state##_sm_receive, \
state##_sm_reject, \
state##_sm_send, \
state##_sm_transportError, \
state##_Default
#define ENTRY_STATE(state) \
if ((state)->Entry != NULL) { \
(state)->Entry(fsm); \
}
#define EXIT_STATE(state)
static void tsip_dialog_messageState_sm_1xx(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_2xx(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_300_to_699(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_401_407_421_494(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_accept(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_cancel(struct tsip_dialog_messageContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_error(struct tsip_dialog_messageContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_receive(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_reject(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_send(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_sm_transportError(struct tsip_dialog_messageContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_messageState_Default(struct tsip_dialog_messageContext *fsm)
{
State_Default(fsm);
}
#define tsip_dialog_message_Started_sm_1xx tsip_dialog_messageState_sm_1xx
#define tsip_dialog_message_Started_sm_2xx tsip_dialog_messageState_sm_2xx
#define tsip_dialog_message_Started_sm_300_to_699 tsip_dialog_messageState_sm_300_to_699
#define tsip_dialog_message_Started_sm_401_407_421_494 tsip_dialog_messageState_sm_401_407_421_494
#define tsip_dialog_message_Started_sm_accept tsip_dialog_messageState_sm_accept
#define tsip_dialog_message_Started_sm_cancel tsip_dialog_messageState_sm_cancel
#define tsip_dialog_message_Started_sm_error tsip_dialog_messageState_sm_error
#define tsip_dialog_message_Started_sm_receive tsip_dialog_messageState_sm_receive
#define tsip_dialog_message_Started_sm_reject tsip_dialog_messageState_sm_reject
#define tsip_dialog_message_Started_sm_send tsip_dialog_messageState_sm_send
#define tsip_dialog_message_Started_sm_transportError tsip_dialog_messageState_sm_transportError
#define tsip_dialog_message_Started_Default tsip_dialog_messageState_Default
#define tsip_dialog_message_Started_Entry NULL
#define tsip_dialog_message_Started_Exit NULL
#define tsip_dialog_message_Sending_sm_1xx tsip_dialog_messageState_sm_1xx
#define tsip_dialog_message_Sending_sm_2xx tsip_dialog_messageState_sm_2xx
#define tsip_dialog_message_Sending_sm_300_to_699 tsip_dialog_messageState_sm_300_to_699
#define tsip_dialog_message_Sending_sm_401_407_421_494 tsip_dialog_messageState_sm_401_407_421_494
#define tsip_dialog_message_Sending_sm_accept tsip_dialog_messageState_sm_accept
#define tsip_dialog_message_Sending_sm_cancel tsip_dialog_messageState_sm_cancel
#define tsip_dialog_message_Sending_sm_error tsip_dialog_messageState_sm_error
#define tsip_dialog_message_Sending_sm_receive tsip_dialog_messageState_sm_receive
#define tsip_dialog_message_Sending_sm_reject tsip_dialog_messageState_sm_reject
#define tsip_dialog_message_Sending_sm_send tsip_dialog_messageState_sm_send
#define tsip_dialog_message_Sending_sm_transportError tsip_dialog_messageState_sm_transportError
#define tsip_dialog_message_Sending_Default tsip_dialog_messageState_Default
#define tsip_dialog_message_Sending_Entry NULL
#define tsip_dialog_message_Sending_Exit NULL
#define tsip_dialog_message_Receiving_sm_1xx tsip_dialog_messageState_sm_1xx
#define tsip_dialog_message_Receiving_sm_2xx tsip_dialog_messageState_sm_2xx
#define tsip_dialog_message_Receiving_sm_300_to_699 tsip_dialog_messageState_sm_300_to_699
#define tsip_dialog_message_Receiving_sm_401_407_421_494 tsip_dialog_messageState_sm_401_407_421_494
#define tsip_dialog_message_Receiving_sm_accept tsip_dialog_messageState_sm_accept
#define tsip_dialog_message_Receiving_sm_cancel tsip_dialog_messageState_sm_cancel
#define tsip_dialog_message_Receiving_sm_error tsip_dialog_messageState_sm_error
#define tsip_dialog_message_Receiving_sm_receive tsip_dialog_messageState_sm_receive
#define tsip_dialog_message_Receiving_sm_reject tsip_dialog_messageState_sm_reject
#define tsip_dialog_message_Receiving_sm_send tsip_dialog_messageState_sm_send
#define tsip_dialog_message_Receiving_sm_transportError tsip_dialog_messageState_sm_transportError
#define tsip_dialog_message_Receiving_Default tsip_dialog_messageState_Default
#define tsip_dialog_message_Receiving_Entry NULL
#define tsip_dialog_message_Receiving_Exit NULL
#define tsip_dialog_message_Terminated_sm_1xx tsip_dialog_messageState_sm_1xx
#define tsip_dialog_message_Terminated_sm_2xx tsip_dialog_messageState_sm_2xx
#define tsip_dialog_message_Terminated_sm_300_to_699 tsip_dialog_messageState_sm_300_to_699
#define tsip_dialog_message_Terminated_sm_401_407_421_494 tsip_dialog_messageState_sm_401_407_421_494
#define tsip_dialog_message_Terminated_sm_accept tsip_dialog_messageState_sm_accept
#define tsip_dialog_message_Terminated_sm_cancel tsip_dialog_messageState_sm_cancel
#define tsip_dialog_message_Terminated_sm_error tsip_dialog_messageState_sm_error
#define tsip_dialog_message_Terminated_sm_receive tsip_dialog_messageState_sm_receive
#define tsip_dialog_message_Terminated_sm_reject tsip_dialog_messageState_sm_reject
#define tsip_dialog_message_Terminated_sm_send tsip_dialog_messageState_sm_send
#define tsip_dialog_message_Terminated_sm_transportError tsip_dialog_messageState_sm_transportError
#define tsip_dialog_message_Terminated_Default tsip_dialog_messageState_Default
#define tsip_dialog_message_Terminated_Entry NULL
#define tsip_dialog_message_Terminated_Exit NULL
#define tsip_dialog_message_DefaultState_sm_1xx tsip_dialog_messageState_sm_1xx
#define tsip_dialog_message_DefaultState_sm_2xx tsip_dialog_messageState_sm_2xx
#define tsip_dialog_message_DefaultState_sm_300_to_699 tsip_dialog_messageState_sm_300_to_699
#define tsip_dialog_message_DefaultState_sm_401_407_421_494 tsip_dialog_messageState_sm_401_407_421_494
#define tsip_dialog_message_DefaultState_sm_accept tsip_dialog_messageState_sm_accept
#define tsip_dialog_message_DefaultState_sm_cancel tsip_dialog_messageState_sm_cancel
#define tsip_dialog_message_DefaultState_sm_error tsip_dialog_messageState_sm_error
#define tsip_dialog_message_DefaultState_sm_receive tsip_dialog_messageState_sm_receive
#define tsip_dialog_message_DefaultState_sm_reject tsip_dialog_messageState_sm_reject
#define tsip_dialog_message_DefaultState_sm_send tsip_dialog_messageState_sm_send
#define tsip_dialog_message_DefaultState_sm_transportError tsip_dialog_messageState_sm_transportError
#undef tsip_dialog_message_Started_sm_transportError
#define tsip_dialog_message_Started_sm_transportError tsip_dialog_message_DefaultState_sm_transportError
#undef tsip_dialog_message_Sending_sm_transportError
#define tsip_dialog_message_Sending_sm_transportError tsip_dialog_message_DefaultState_sm_transportError
#undef tsip_dialog_message_Receiving_sm_transportError
#define tsip_dialog_message_Receiving_sm_transportError tsip_dialog_message_DefaultState_sm_transportError
#undef tsip_dialog_message_Terminated_sm_transportError
#define tsip_dialog_message_Terminated_sm_transportError tsip_dialog_message_DefaultState_sm_transportError
#undef tsip_dialog_message_DefaultState_sm_transportError
static void tsip_dialog_message_DefaultState_sm_transportError(struct tsip_dialog_messageContext *fsm)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Any_2_Terminated_X_transportError(ctxt);
setState(fsm, &tsip_dialog_message_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_message_Started_sm_error
#define tsip_dialog_message_Started_sm_error tsip_dialog_message_DefaultState_sm_error
#undef tsip_dialog_message_Sending_sm_error
#define tsip_dialog_message_Sending_sm_error tsip_dialog_message_DefaultState_sm_error
#undef tsip_dialog_message_Receiving_sm_error
#define tsip_dialog_message_Receiving_sm_error tsip_dialog_message_DefaultState_sm_error
#undef tsip_dialog_message_Terminated_sm_error
#define tsip_dialog_message_Terminated_sm_error tsip_dialog_message_DefaultState_sm_error
#undef tsip_dialog_message_DefaultState_sm_error
static void tsip_dialog_message_DefaultState_sm_error(struct tsip_dialog_messageContext *fsm)
{
EXIT_STATE(getState(fsm));
setState(fsm, &tsip_dialog_message_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_message_Started_Default
#define tsip_dialog_message_Started_Default tsip_dialog_message_DefaultState_Default
#undef tsip_dialog_message_Sending_Default
#define tsip_dialog_message_Sending_Default tsip_dialog_message_DefaultState_Default
#undef tsip_dialog_message_Receiving_Default
#define tsip_dialog_message_Receiving_Default tsip_dialog_message_DefaultState_Default
#undef tsip_dialog_message_Terminated_Default
#define tsip_dialog_message_Terminated_Default tsip_dialog_message_DefaultState_Default
#undef tsip_dialog_message_DefaultState_Default
static void tsip_dialog_message_DefaultState_Default(struct tsip_dialog_messageContext *fsm)
{
}
#undef tsip_dialog_message_Started_sm_receive
static void tsip_dialog_message_Started_sm_receive(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Started_2_Receiving_X_recv(ctxt, msg);
setState(fsm, &tsip_dialog_message_Receiving);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_message_Started_sm_send
static void tsip_dialog_message_Started_sm_send(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Started_2_Sending_X_send(ctxt, msg);
setState(fsm, &tsip_dialog_message_Sending);
ENTRY_STATE(getState(fsm));
}
const struct tsip_dialog_messageState tsip_dialog_message_Started = { POPULATE_STATE(tsip_dialog_message_Started), "tsip_dialog_message_Started", 0 };
#undef tsip_dialog_message_Sending_sm_1xx
static void tsip_dialog_message_Sending_sm_1xx(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
const struct tsip_dialog_messageState* EndStateName = getState(fsm);
clearState(fsm);
tsip_dialog_message_Sending_2_Sending_X_1xx(ctxt, msg);
setState(fsm, EndStateName);
}
#undef tsip_dialog_message_Sending_sm_2xx
static void tsip_dialog_message_Sending_sm_2xx(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Sending_2_Terminated_X_2xx(ctxt, msg);
setState(fsm, &tsip_dialog_message_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_message_Sending_sm_300_to_699
static void tsip_dialog_message_Sending_sm_300_to_699(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Sending_2_Terminated_X_300_to_699(ctxt, msg);
setState(fsm, &tsip_dialog_message_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_message_Sending_sm_401_407_421_494
static void tsip_dialog_message_Sending_sm_401_407_421_494(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
const struct tsip_dialog_messageState* EndStateName = getState(fsm);
clearState(fsm);
tsip_dialog_message_Sending_2_Sending_X_401_407_421_494(ctxt, msg);
setState(fsm, EndStateName);
}
#undef tsip_dialog_message_Sending_sm_cancel
static void tsip_dialog_message_Sending_sm_cancel(struct tsip_dialog_messageContext *fsm)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Sending_2_Terminated_X_cancel(ctxt);
setState(fsm, &tsip_dialog_message_Terminated);
ENTRY_STATE(getState(fsm));
}
const struct tsip_dialog_messageState tsip_dialog_message_Sending = { POPULATE_STATE(tsip_dialog_message_Sending), "tsip_dialog_message_Sending", 1 };
#undef tsip_dialog_message_Receiving_sm_accept
static void tsip_dialog_message_Receiving_sm_accept(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Receiving_2_Terminated_X_accept(ctxt, msg);
setState(fsm, &tsip_dialog_message_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_message_Receiving_sm_reject
static void tsip_dialog_message_Receiving_sm_reject(struct tsip_dialog_messageContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_message* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_message_Receiving_2_Terminated_X_reject(ctxt, msg);
setState(fsm, &tsip_dialog_message_Terminated);
ENTRY_STATE(getState(fsm));
}
const struct tsip_dialog_messageState tsip_dialog_message_Receiving = { POPULATE_STATE(tsip_dialog_message_Receiving), "tsip_dialog_message_Receiving", 2 };
#undef tsip_dialog_message_Terminated_Entry
void tsip_dialog_message_Terminated_Entry(struct tsip_dialog_messageContext *fsm)
{
struct tsip_dialog_message *ctxt = getOwner(fsm);
tsip_dialog_message_OnTerminated(ctxt);
}
#undef tsip_dialog_message_Terminated_Default
static void tsip_dialog_message_Terminated_Default(struct tsip_dialog_messageContext *fsm)
{
}
const struct tsip_dialog_messageState tsip_dialog_message_Terminated = { POPULATE_STATE(tsip_dialog_message_Terminated), "tsip_dialog_message_Terminated", 3 };
void tsip_dialog_messageContext_Init(struct tsip_dialog_messageContext* fsm, struct tsip_dialog_message* owner)
{
FSM_INIT(fsm, &tsip_dialog_message_Started);
fsm->_owner = owner;
}
void tsip_dialog_messageContext_EnterStartState(struct tsip_dialog_messageContext* fsm)
{
ENTRY_STATE(getState(fsm));
}
void tsip_dialog_messageContext_sm_1xx(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_1xx");
state->sm_1xx(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_2xx(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_2xx");
state->sm_2xx(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_300_to_699(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_300_to_699");
state->sm_300_to_699(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_401_407_421_494(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_401_407_421_494");
state->sm_401_407_421_494(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_accept(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_accept");
state->sm_accept(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_cancel(struct tsip_dialog_messageContext* fsm)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_cancel");
state->sm_cancel(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_error(struct tsip_dialog_messageContext* fsm)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_error");
state->sm_error(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_receive(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_receive");
state->sm_receive(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_reject(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_reject");
state->sm_reject(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_send(struct tsip_dialog_messageContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_send");
state->sm_send(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_messageContext_sm_transportError(struct tsip_dialog_messageContext* fsm)
{
const struct tsip_dialog_messageState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_transportError");
state->sm_transportError(fsm);
setTransition(fsm, NULL);
}
/*
* Local variables:
* buffer-read-only: t
* End:
*/

View File

@ -77,17 +77,17 @@ static void tsip_transac_nictState_sm_send(struct tsip_transac_nictContext *fsm)
getState(fsm)->Default(fsm);
}
static void tsip_transac_nictState_sm_timerE(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nictState_sm_timerE(struct tsip_transac_nictContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_transac_nictState_sm_timerF(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nictState_sm_timerF(struct tsip_transac_nictContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_transac_nictState_sm_timerK(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nictState_sm_timerK(struct tsip_transac_nictContext *fsm)
{
getState(fsm)->Default(fsm);
}
@ -237,7 +237,7 @@ static void tsip_transac_nict_Trying_sm_200_to_699(struct tsip_transac_nictConte
}
#undef tsip_transac_nict_Trying_sm_timerE
static void tsip_transac_nict_Trying_sm_timerE(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nict_Trying_sm_timerE(struct tsip_transac_nictContext *fsm)
{
struct tsip_transac_nict* ctxt = getOwner(fsm);
const struct tsip_transac_nictState* EndStateName = getState(fsm);
@ -248,7 +248,7 @@ static void tsip_transac_nict_Trying_sm_timerE(struct tsip_transac_nictContext *
}
#undef tsip_transac_nict_Trying_sm_timerF
static void tsip_transac_nict_Trying_sm_timerF(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nict_Trying_sm_timerF(struct tsip_transac_nictContext *fsm)
{
struct tsip_transac_nict* ctxt = getOwner(fsm);
@ -297,7 +297,7 @@ static void tsip_transac_nict_Proceeding_sm_200_to_699(struct tsip_transac_nictC
}
#undef tsip_transac_nict_Proceeding_sm_timerE
static void tsip_transac_nict_Proceeding_sm_timerE(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nict_Proceeding_sm_timerE(struct tsip_transac_nictContext *fsm)
{
struct tsip_transac_nict* ctxt = getOwner(fsm);
const struct tsip_transac_nictState* EndStateName = getState(fsm);
@ -308,7 +308,7 @@ static void tsip_transac_nict_Proceeding_sm_timerE(struct tsip_transac_nictConte
}
#undef tsip_transac_nict_Proceeding_sm_timerF
static void tsip_transac_nict_Proceeding_sm_timerF(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nict_Proceeding_sm_timerF(struct tsip_transac_nictContext *fsm)
{
struct tsip_transac_nict* ctxt = getOwner(fsm);
@ -334,7 +334,7 @@ static void tsip_transac_nict_Proceeding_sm_transportError(struct tsip_transac_n
const struct tsip_transac_nictState tsip_transac_nict_Proceeding = { POPULATE_STATE(tsip_transac_nict_Proceeding), "tsip_transac_nict_Proceeding", 2 };
#undef tsip_transac_nict_Completed_sm_timerK
static void tsip_transac_nict_Completed_sm_timerK(struct tsip_transac_nictContext *fsm, tsk_timer_id_t timer_id)
static void tsip_transac_nict_Completed_sm_timerK(struct tsip_transac_nictContext *fsm)
{
struct tsip_transac_nict* ctxt = getOwner(fsm);
@ -398,33 +398,33 @@ void tsip_transac_nictContext_sm_send(struct tsip_transac_nictContext* fsm)
setTransition(fsm, NULL);
}
void tsip_transac_nictContext_sm_timerE(struct tsip_transac_nictContext* fsm, tsk_timer_id_t timer_id)
void tsip_transac_nictContext_sm_timerE(struct tsip_transac_nictContext* fsm)
{
const struct tsip_transac_nictState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_timerE");
state->sm_timerE(fsm, timer_id);
state->sm_timerE(fsm);
setTransition(fsm, NULL);
}
void tsip_transac_nictContext_sm_timerF(struct tsip_transac_nictContext* fsm, tsk_timer_id_t timer_id)
void tsip_transac_nictContext_sm_timerF(struct tsip_transac_nictContext* fsm)
{
const struct tsip_transac_nictState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_timerF");
state->sm_timerF(fsm, timer_id);
state->sm_timerF(fsm);
setTransition(fsm, NULL);
}
void tsip_transac_nictContext_sm_timerK(struct tsip_transac_nictContext* fsm, tsk_timer_id_t timer_id)
void tsip_transac_nictContext_sm_timerK(struct tsip_transac_nictContext* fsm)
{
const struct tsip_transac_nictState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_timerK");
state->sm_timerK(fsm, timer_id);
state->sm_timerK(fsm);
setTransition(fsm, NULL);
}

View File

@ -46,9 +46,9 @@
#define POPULATE_STATE(state) \
state##_Entry, \
state##_sm_recv_request, \
state##_sm_send_1xx, \
state##_sm_send_200_to_699, \
state##_sm_send_response, \
state##_sm_timerJ, \
state##_sm_transportError, \
state##_Default
@ -60,17 +60,17 @@
#define EXIT_STATE(state)
static void tsip_transac_nistState_sm_send_1xx(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
static void tsip_transac_nistState_sm_recv_request(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
getState(fsm)->Default(fsm);
}
static void tsip_transac_nistState_sm_send_200_to_699(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
static void tsip_transac_nistState_sm_send_1xx(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
getState(fsm)->Default(fsm);
}
static void tsip_transac_nistState_sm_send_response(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
static void tsip_transac_nistState_sm_send_200_to_699(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
getState(fsm)->Default(fsm);
}
@ -90,44 +90,54 @@ static void tsip_transac_nistState_Default(struct tsip_transac_nistContext *fsm)
State_Default(fsm);
}
#define tsip_transac_nist_Started_sm_recv_request tsip_transac_nistState_sm_recv_request
#define tsip_transac_nist_Started_sm_send_1xx tsip_transac_nistState_sm_send_1xx
#define tsip_transac_nist_Started_sm_send_200_to_699 tsip_transac_nistState_sm_send_200_to_699
#define tsip_transac_nist_Started_sm_timerJ tsip_transac_nistState_sm_timerJ
#define tsip_transac_nist_Started_sm_transportError tsip_transac_nistState_sm_transportError
#define tsip_transac_nist_Started_Default tsip_transac_nistState_Default
#define tsip_transac_nist_Started_Entry NULL
#define tsip_transac_nist_Started_Exit NULL
#define tsip_transac_nist_Trying_sm_recv_request tsip_transac_nistState_sm_recv_request
#define tsip_transac_nist_Trying_sm_send_1xx tsip_transac_nistState_sm_send_1xx
#define tsip_transac_nist_Trying_sm_send_200_to_699 tsip_transac_nistState_sm_send_200_to_699
#define tsip_transac_nist_Trying_sm_send_response tsip_transac_nistState_sm_send_response
#define tsip_transac_nist_Trying_sm_timerJ tsip_transac_nistState_sm_timerJ
#define tsip_transac_nist_Trying_sm_transportError tsip_transac_nistState_sm_transportError
#define tsip_transac_nist_Trying_Default tsip_transac_nistState_Default
#define tsip_transac_nist_Trying_Entry NULL
#define tsip_transac_nist_Trying_Exit NULL
#define tsip_transac_nist_Proceeding_sm_recv_request tsip_transac_nistState_sm_recv_request
#define tsip_transac_nist_Proceeding_sm_send_1xx tsip_transac_nistState_sm_send_1xx
#define tsip_transac_nist_Proceeding_sm_send_200_to_699 tsip_transac_nistState_sm_send_200_to_699
#define tsip_transac_nist_Proceeding_sm_send_response tsip_transac_nistState_sm_send_response
#define tsip_transac_nist_Proceeding_sm_timerJ tsip_transac_nistState_sm_timerJ
#define tsip_transac_nist_Proceeding_sm_transportError tsip_transac_nistState_sm_transportError
#define tsip_transac_nist_Proceeding_Default tsip_transac_nistState_Default
#define tsip_transac_nist_Proceeding_Entry NULL
#define tsip_transac_nist_Proceeding_Exit NULL
#define tsip_transac_nist_Completed_sm_recv_request tsip_transac_nistState_sm_recv_request
#define tsip_transac_nist_Completed_sm_send_1xx tsip_transac_nistState_sm_send_1xx
#define tsip_transac_nist_Completed_sm_send_200_to_699 tsip_transac_nistState_sm_send_200_to_699
#define tsip_transac_nist_Completed_sm_send_response tsip_transac_nistState_sm_send_response
#define tsip_transac_nist_Completed_sm_timerJ tsip_transac_nistState_sm_timerJ
#define tsip_transac_nist_Completed_sm_transportError tsip_transac_nistState_sm_transportError
#define tsip_transac_nist_Completed_Default tsip_transac_nistState_Default
#define tsip_transac_nist_Completed_Entry NULL
#define tsip_transac_nist_Completed_Exit NULL
#define tsip_transac_nist_Terminated_sm_recv_request tsip_transac_nistState_sm_recv_request
#define tsip_transac_nist_Terminated_sm_send_1xx tsip_transac_nistState_sm_send_1xx
#define tsip_transac_nist_Terminated_sm_send_200_to_699 tsip_transac_nistState_sm_send_200_to_699
#define tsip_transac_nist_Terminated_sm_send_response tsip_transac_nistState_sm_send_response
#define tsip_transac_nist_Terminated_sm_timerJ tsip_transac_nistState_sm_timerJ
#define tsip_transac_nist_Terminated_sm_transportError tsip_transac_nistState_sm_transportError
#define tsip_transac_nist_Terminated_Default tsip_transac_nistState_Default
#define tsip_transac_nist_Terminated_Entry NULL
#define tsip_transac_nist_Terminated_Exit NULL
#define tsip_transac_nist_DefaultState_sm_recv_request tsip_transac_nistState_sm_recv_request
#define tsip_transac_nist_DefaultState_sm_send_1xx tsip_transac_nistState_sm_send_1xx
#define tsip_transac_nist_DefaultState_sm_send_200_to_699 tsip_transac_nistState_sm_send_200_to_699
#define tsip_transac_nist_DefaultState_sm_send_response tsip_transac_nistState_sm_send_response
#define tsip_transac_nist_DefaultState_sm_timerJ tsip_transac_nistState_sm_timerJ
#define tsip_transac_nist_DefaultState_sm_transportError tsip_transac_nistState_sm_transportError
#undef tsip_transac_nist_Started_sm_transportError
#define tsip_transac_nist_Started_sm_transportError tsip_transac_nist_DefaultState_sm_transportError
#undef tsip_transac_nist_Trying_sm_transportError
#define tsip_transac_nist_Trying_sm_transportError tsip_transac_nist_DefaultState_sm_transportError
#undef tsip_transac_nist_Proceeding_sm_transportError
@ -148,6 +158,8 @@ static void tsip_transac_nist_DefaultState_sm_transportError(struct tsip_transac
ENTRY_STATE(getState(fsm));
}
#undef tsip_transac_nist_Started_Default
#define tsip_transac_nist_Started_Default tsip_transac_nist_DefaultState_Default
#undef tsip_transac_nist_Trying_Default
#define tsip_transac_nist_Trying_Default tsip_transac_nist_DefaultState_Default
#undef tsip_transac_nist_Proceeding_Default
@ -162,76 +174,90 @@ static void tsip_transac_nist_DefaultState_Default(struct tsip_transac_nistConte
}
#undef tsip_transac_nist_Trying_sm_send_1xx
static void tsip_transac_nist_Trying_sm_send_1xx(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
#undef tsip_transac_nist_Started_sm_recv_request
static void tsip_transac_nist_Started_sm_recv_request(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_transac_nist_Trying_2_Proceeding_X_send_1xx(ctxt, msg);
tsip_transac_nist_Started_2_Trying_X_recv_request(ctxt, request);
setState(fsm, &tsip_transac_nist_Trying);
ENTRY_STATE(getState(fsm));
}
const struct tsip_transac_nistState tsip_transac_nist_Started = { POPULATE_STATE(tsip_transac_nist_Started), "tsip_transac_nist_Started", 0 };
#undef tsip_transac_nist_Trying_sm_send_1xx
static void tsip_transac_nist_Trying_sm_send_1xx(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_transac_nist_Trying_2_Proceeding_X_send_1xx(ctxt, request);
setState(fsm, &tsip_transac_nist_Proceeding);
ENTRY_STATE(getState(fsm));
}
#undef tsip_transac_nist_Trying_sm_send_200_to_699
static void tsip_transac_nist_Trying_sm_send_200_to_699(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
static void tsip_transac_nist_Trying_sm_send_200_to_699(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_transac_nist_Trying_2_Completed_X_send_200_to_699(ctxt, msg);
tsip_transac_nist_Trying_2_Completed_X_send_200_to_699(ctxt, request);
setState(fsm, &tsip_transac_nist_Completed);
ENTRY_STATE(getState(fsm));
}
const struct tsip_transac_nistState tsip_transac_nist_Trying = { POPULATE_STATE(tsip_transac_nist_Trying), "tsip_transac_nist_Trying", 0 };
const struct tsip_transac_nistState tsip_transac_nist_Trying = { POPULATE_STATE(tsip_transac_nist_Trying), "tsip_transac_nist_Trying", 1 };
#undef tsip_transac_nist_Proceeding_sm_send_1xx
static void tsip_transac_nist_Proceeding_sm_send_1xx(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
#undef tsip_transac_nist_Proceeding_sm_recv_request
static void tsip_transac_nist_Proceeding_sm_recv_request(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
const struct tsip_transac_nistState* EndStateName = getState(fsm);
clearState(fsm);
tsip_transac_nist_Proceeding_2_Proceeding_X_send_1xx(ctxt, msg);
tsip_transac_nist_Proceeding_2_Proceeding_X_recv_request(ctxt, request);
setState(fsm, EndStateName);
}
#undef tsip_transac_nist_Proceeding_sm_send_1xx
static void tsip_transac_nist_Proceeding_sm_send_1xx(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
const struct tsip_transac_nistState* EndStateName = getState(fsm);
clearState(fsm);
tsip_transac_nist_Proceeding_2_Proceeding_X_send_1xx(ctxt, request);
setState(fsm, EndStateName);
}
#undef tsip_transac_nist_Proceeding_sm_send_200_to_699
static void tsip_transac_nist_Proceeding_sm_send_200_to_699(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
static void tsip_transac_nist_Proceeding_sm_send_200_to_699(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_transac_nist_Proceeding_2_Completed_X_send_200_to_699(ctxt, msg);
tsip_transac_nist_Proceeding_2_Completed_X_send_200_to_699(ctxt, request);
setState(fsm, &tsip_transac_nist_Completed);
ENTRY_STATE(getState(fsm));
}
#undef tsip_transac_nist_Proceeding_sm_send_response
static void tsip_transac_nist_Proceeding_sm_send_response(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
const struct tsip_transac_nistState tsip_transac_nist_Proceeding = { POPULATE_STATE(tsip_transac_nist_Proceeding), "tsip_transac_nist_Proceeding", 2 };
#undef tsip_transac_nist_Completed_sm_recv_request
static void tsip_transac_nist_Completed_sm_recv_request(struct tsip_transac_nistContext *fsm, const tsip_request_t* request)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
const struct tsip_transac_nistState* EndStateName = getState(fsm);
clearState(fsm);
tsip_transac_nist_Proceeding_2_Proceeding_X_send_response(ctxt, msg);
setState(fsm, EndStateName);
}
const struct tsip_transac_nistState tsip_transac_nist_Proceeding = { POPULATE_STATE(tsip_transac_nist_Proceeding), "tsip_transac_nist_Proceeding", 1 };
#undef tsip_transac_nist_Completed_sm_send_response
static void tsip_transac_nist_Completed_sm_send_response(struct tsip_transac_nistContext *fsm, const tsip_message_t* msg)
{
struct tsip_transac_nist* ctxt = getOwner(fsm);
const struct tsip_transac_nistState* EndStateName = getState(fsm);
clearState(fsm);
tsip_transac_nist_Completed_2_Completed_X_send_response(ctxt, msg);
tsip_transac_nist_Completed_2_Completed_X_recv_request(ctxt, request);
setState(fsm, EndStateName);
}
@ -247,7 +273,7 @@ static void tsip_transac_nist_Completed_sm_timerJ(struct tsip_transac_nistContex
ENTRY_STATE(getState(fsm));
}
const struct tsip_transac_nistState tsip_transac_nist_Completed = { POPULATE_STATE(tsip_transac_nist_Completed), "tsip_transac_nist_Completed", 2 };
const struct tsip_transac_nistState tsip_transac_nist_Completed = { POPULATE_STATE(tsip_transac_nist_Completed), "tsip_transac_nist_Completed", 3 };
#undef tsip_transac_nist_Terminated_Entry
void tsip_transac_nist_Terminated_Entry(struct tsip_transac_nistContext *fsm)
@ -257,11 +283,11 @@ void tsip_transac_nist_Terminated_Entry(struct tsip_transac_nistContext *fsm)
tsip_transac_nist_OnTerminated(ctxt);
}
const struct tsip_transac_nistState tsip_transac_nist_Terminated = { POPULATE_STATE(tsip_transac_nist_Terminated), "tsip_transac_nist_Terminated", 3 };
const struct tsip_transac_nistState tsip_transac_nist_Terminated = { POPULATE_STATE(tsip_transac_nist_Terminated), "tsip_transac_nist_Terminated", 4 };
void tsip_transac_nistContext_Init(struct tsip_transac_nistContext* fsm, struct tsip_transac_nist* owner)
{
FSM_INIT(fsm, &tsip_transac_nist_Trying);
FSM_INIT(fsm, &tsip_transac_nist_Started);
fsm->_owner = owner;
}
@ -270,33 +296,33 @@ void tsip_transac_nistContext_EnterStartState(struct tsip_transac_nistContext* f
ENTRY_STATE(getState(fsm));
}
void tsip_transac_nistContext_sm_send_1xx(struct tsip_transac_nistContext* fsm, const tsip_message_t* msg)
void tsip_transac_nistContext_sm_recv_request(struct tsip_transac_nistContext* fsm, const tsip_request_t* request)
{
const struct tsip_transac_nistState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_recv_request");
state->sm_recv_request(fsm, request);
setTransition(fsm, NULL);
}
void tsip_transac_nistContext_sm_send_1xx(struct tsip_transac_nistContext* fsm, const tsip_request_t* request)
{
const struct tsip_transac_nistState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_send_1xx");
state->sm_send_1xx(fsm, msg);
state->sm_send_1xx(fsm, request);
setTransition(fsm, NULL);
}
void tsip_transac_nistContext_sm_send_200_to_699(struct tsip_transac_nistContext* fsm, const tsip_message_t* msg)
void tsip_transac_nistContext_sm_send_200_to_699(struct tsip_transac_nistContext* fsm, const tsip_request_t* request)
{
const struct tsip_transac_nistState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_send_200_to_699");
state->sm_send_200_to_699(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_transac_nistContext_sm_send_response(struct tsip_transac_nistContext* fsm, const tsip_message_t* msg)
{
const struct tsip_transac_nistState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_send_response");
state->sm_send_response(fsm, msg);
state->sm_send_200_to_699(fsm, request);
setTransition(fsm, NULL);
}

View File

@ -39,6 +39,8 @@ int tsip_transac_init(tsip_transac_t *transac, const tsip_stack_handle_t * stack
{
if(transac)
{
tsk_safeobj_init(transac);
transac->stack = stack;
transac->timer_mgr = tsip_stack_get_timer_mgr(stack);
transac->type = type;
@ -52,6 +54,23 @@ int tsip_transac_init(tsip_transac_t *transac, const tsip_stack_handle_t * stack
return -1;
}
int tsip_transac_deinit(tsip_transac_t *transac)
{
if(transac)
{
transac->stack = 0;
TSK_FREE(transac->branch);
TSK_FREE(transac->cseq_method);
TSK_FREE(transac->callid);
tsk_safeobj_deinit(transac);
return 0;
}
return -1;
}
int tsip_transac_send(tsip_transac_t *self, const char *branch, const tsip_message_t *msg)
{
@ -75,21 +94,6 @@ int tsip_transac_cmp(const tsip_transac_t *t1, const tsip_transac_t *t2)
return -1;
}
int tsip_transac_deinit(tsip_transac_t *transac)
{
if(transac)
{
transac->stack = 0;
TSK_FREE(transac->branch);
TSK_FREE(transac->cseq_method);
TSK_FREE(transac->callid);
return 0;
}
return -1;
}
int tsip_transac_remove_callback(const tsip_transac_t* self, tsk_timer_id_t timer_id)
{
return tsip_transac_layer_remove(TSIP_STACK(self->stack)->layer_transac, TSIP_TRANSAC(self));

View File

@ -37,7 +37,7 @@
#include "tsk_string.h"
const tsip_transac_t* tsip_transac_layer_new(tsip_transac_layer_t *self, const tsip_message_t* msg)
const tsip_transac_t* tsip_transac_layer_new(const tsip_transac_layer_t *self, int isCT, const tsip_message_t* msg)
{
tsip_transac_t *ret = 0;
@ -47,28 +47,40 @@ const tsip_transac_t* tsip_transac_layer_new(tsip_transac_layer_t *self, const t
{
if(TSIP_MESSAGE_IS_REQUEST(msg))
{
if(tsk_striequals(TSIP_MESSAGE_AS_REQUEST(msg)->line_request.method, "INVITE"))
if(isCT)
{
// INVITE Client transaction (ICT)
}
else
{
// NON-INVITE Client transaction (NICT)
tsip_transac_nict_t *transac = TSIP_TRANSAC_NICT_CREATE(self->stack, 0, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value);
ret = TSIP_TRANSAC(transac);
if(tsk_striequals(TSIP_MESSAGE_AS_REQUEST(msg)->line_request.method, "INVITE"))
{
// INVITE Client transaction (ICT)
}
else
{
// NON-INVITE Client transaction (NICT)
tsip_transac_nict_t *transac = TSIP_TRANSAC_NICT_CREATE(self->stack, 0, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value);
ret = TSIP_TRANSAC(transac);
tsk_list_push_back_data(self->transactions, (void**)&transac);
}
}
else
{
if(tsk_striequals(TSIP_MESSAGE_AS_REQUEST(msg)->line_request.method, "INVITE"))
{
// INVITE Server transaction (IST)
tsk_list_push_back_data(self->transactions, (void**)&transac);
}
}
else
{
// NON-INVITE Server transaction (NIST)
if(tsk_striequals(TSIP_MESSAGE_AS_REQUEST(msg)->line_request.method, "INVITE"))
{
// INVITE Server transaction (IST)
}
else
{
// NON-INVITE Server transaction (NIST)
tsip_transac_nist_t *transac = TSIP_TRANSAC_NIST_CREATE(self->stack, 0, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value);
ret = TSIP_TRANSAC(transac);
tsk_list_push_back_data(self->transactions, (void**)&transac);
}
if(ret)
{
ret->branch = tsk_strdup(msg->firstVia->branch);
}
}
}
}
@ -92,7 +104,7 @@ int tsip_transac_layer_remove(tsip_transac_layer_t *self, const tsip_transac_t *
return -1;
}
const tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t *self, const char* branch, const char* cseq_method)
const tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t *self, const tsip_response_t* response)
{
/*
RFC 3261 - 17.1.3 Matching Responses to Client Transactions
@ -118,18 +130,123 @@ const tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t
tsip_transac_t *transac;
tsk_list_item_t *item;
tsk_safeobj_lock(self);
/* Check first Via/CSeq validity.
*/
if(!response->firstVia || !response->CSeq)
{
return 0;
}
//tsk_safeobj_lock(self);
tsk_list_foreach(item, self->transactions)
{
transac = item->data;
if(transac->running && tsk_striequals(transac->branch, branch) && tsk_striequals(transac->cseq_method, cseq_method))
if( tsk_strequals(transac->branch, response->firstVia->branch)
&& tsk_strequals(transac->cseq_method, response->CSeq->method)
)
{
ret = transac;
break;
}
}
//tsk_safeobj_unlock(self);
return ret;
}
const tsip_transac_t* tsip_transac_layer_find_server(const tsip_transac_layer_t *self, const tsip_request_t* request)
{
/*
RFC 3261 - 17.2.3 Matching Requests to Server Transactions
When a request is received from the network by the server, it has to
be matched to an existing transaction. This is accomplished in the
following manner.
The branch parameter in the topmost Via header field of the request
is examined. If it is present and begins with the magic cookie
"z9hG4bK", the request was generated by a client transaction
compliant to this specification. Therefore, the branch parameter
will be unique across all transactions sent by that client. The
request matches a transaction if:
1. the branch parameter in the request is equal to the one in the
top Via header field of the request that created the
transaction, and
2. the sent-by value in the top Via of the request is equal to the
one in the request that created the transaction, and
3. the method of the request matches the one that created the
transaction, except for ACK, where the method of the request
that created the transaction is INVITE.
*/
tsip_transac_t *ret = 0;
tsip_transac_t *transac;
tsk_list_item_t *item;
//const char* sent_by;
/* Check first Via/CSeq validity.
*/
if(!request->firstVia || !request->CSeq)
{
return 0;
}
//tsk_safeobj_lock(self);
tsk_list_foreach(item, self->transactions)
{
transac = item->data;
if(tsk_strequals(transac->branch, request->firstVia->branch)
&& (1 == 1) /* FIXME: compare host:ip */
)
{
if(tsk_strequals(transac->cseq_method, TSIP_REQUEST_METHOD(request)))
{
ret = transac;
break;
}
else if(tsk_strequals("ACK", TSIP_REQUEST_METHOD(request)) || tsk_strequals("CANCEL", TSIP_REQUEST_METHOD(request)))
{
ret = transac;
break;
}
}
}
//tsk_safeobj_unlock(self);
return ret;
}
int tsip_transac_layer_handle_msg(const tsip_transac_layer_t *self, int incoming, const tsip_message_t* message)
{
int ret = -1;
const tsip_transac_t *transac = 0;
tsk_safeobj_lock(self);
if(TSIP_MESSAGE_IS_REQUEST(message))
{
transac = tsip_transac_layer_find_server(self, TSIP_MESSAGE_AS_REQUEST(message));
}
else
{
transac = tsip_transac_layer_find_client(self, TSIP_MESSAGE_AS_RESPONSE(message));
}
if(transac)
{
transac->callback(transac, incoming?tsip_transac_incoming_msg:tsip_transac_outgoing_msg, message);
ret = 0;
}
tsk_safeobj_unlock(self);
return ret;
@ -139,6 +256,12 @@ const tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t
//========================================================
// Transaction layer object definition
//

View File

@ -90,29 +90,30 @@
* @author Mamadou
* @date 1/4/2010
*
* @param [in,out] arg Opaque data. Shall contain a reference to the transaction itself.
* @param [in,out] self A pointer to the NIC transaction.
* @param type The event type.
* @param [in,out] msg The incoming message.
*
* @return Zero if succeed and no-zero error code otherwise.
**/
int tsip_transac_nict_event_callback(const void *arg, tsip_transac_event_type_t type, const tsip_message_t *msg)
int tsip_transac_nict_event_callback(const tsip_transac_nict_t *self, tsip_transac_event_type_t type, const tsip_message_t *msg)
{
const tsip_transac_nict_t* transac = arg;
TSIP_TRANSAC_SYNC_BEGIN(self);
switch(type)
{
case tsip_transac_msg:
case tsip_transac_incoming_msg:
{
if(msg && TSIP_MESSAGE_IS_RESPONSE(msg))
{
short status_code = TSIP_RESPONSE_CODE(msg);
if(status_code <=199)
{
tsip_transac_nictContext_sm_1xx(&TSIP_TRANSAC_NICT(transac)->_fsm, msg);
tsip_transac_nictContext_sm_1xx(&TSIP_TRANSAC_NICT(self)->_fsm, msg);
}
else if(status_code<=699)
{
tsip_transac_nictContext_sm_200_to_699(&TSIP_TRANSAC_NICT(transac)->_fsm, msg);
tsip_transac_nictContext_sm_200_to_699(&TSIP_TRANSAC_NICT(self)->_fsm, msg);
}
else
{
@ -148,9 +149,41 @@ int tsip_transac_nict_event_callback(const void *arg, tsip_transac_event_type_t
}
}
TSIP_TRANSAC_SYNC_END(self);
return 0;
}
int tsip_transac_nict_timer_callback(const tsip_transac_nict_t* self, tsk_timer_id_t timer_id)
{
int ret = -1;
if(self)
{
TSIP_TRANSAC_SYNC_BEGIN(self);
if(timer_id == self->timerE.id)
{
tsip_transac_nictContext_sm_timerE(&TSIP_TRANSAC_NICT(self)->_fsm);
ret = 0;
}
else if(timer_id == self->timerF.id)
{
tsip_transac_nictContext_sm_timerF(&TSIP_TRANSAC_NICT(self)->_fsm);
ret = 0;
}
else if(timer_id == self->timerK.id)
{
tsip_transac_nictContext_sm_timerK(&TSIP_TRANSAC_NICT(self)->_fsm);
ret = 0;
}
TSIP_TRANSAC_SYNC_END(self);
}
return ret;
}
/**
* @fn void tsip_transac_nict_init(tsip_transac_nict_t *self)
*
@ -167,7 +200,7 @@ void tsip_transac_nict_init(tsip_transac_nict_t *self)
*/
tsip_transac_nictContext_Init(&self->_fsm, self);
/* Set callback function to call when new messages are arrive or errors happen in
/* Set callback function to call when new messages arrive or errors happen in
the transport layer.
*/
TSIP_TRANSAC(self)->callback = tsip_transac_nict_event_callback;
@ -182,7 +215,7 @@ void tsip_transac_nict_init(tsip_transac_nict_t *self)
self->timerE.timeout = TSIP_TIMER_GET(E);
self->timerF.timeout = TSIP_TIMER_GET(F);
self->timerK.timeout = TSIP_TRANSAC(self)->reliable ? 0 : TSIP_TIMER_GET(K); /* RFC 3261 - 17.1.2.2 [Proceeding_2_Completed_X_200_to_699]*/
self->timerK.timeout = TSIP_TRANSAC(self)->reliable ? 0 : TSIP_TIMER_GET(K); /* RFC 3261 - 17.1.2.2*/
}

View File

@ -20,6 +20,50 @@
*
*/
/*=============================================================================
|Request received
|pass to TU
V
+-----------+
| |
| Trying |-------------+
| | |
+-----------+ |200-699 from TU
| |send response
|1xx from TU |
|send response |
| |
Request V 1xx from TU |
send response+-----------+send response|
+--------| |--------+ |
| | Proceeding| | |
+------->| |<-------+ |
+<--------------| | |
|Trnsprt Err +-----------+ |
|Inform TU | |
| | |
| |200-699 from TU |
| |send response |
| Request V |
| send response+-----------+ |
| +--------| | |
| | | Completed |<------------+
| +------->| |
+<--------------| |
|Trnsprt Err +-----------+
|Inform TU |
| |Timer J fires
| |-
| |
| V
| +-----------+
| | |
+-------------->| Terminated|
| |
+-----------+
=============================================================================*/
/**@file tsip_transac_nist.c
* @brief SIP Non-INVITE Server Transaction as per RFC 3261 subclause 17.2.2.
*
@ -29,10 +73,98 @@
*/
#include "tinysip/transactions/tsip_transac_nist.h"
#include "tsk_debug.h"
#define DEBUG_STATE_MACHINE 1
#define TRANSAC_NIST_TIMER_SCHEDULE(TX) TRANSAC_TIMER_SCHEDULE(nist, TX)
int tsip_transac_nist_event_callback(const tsip_transac_nist_t *self, tsip_transac_event_type_t type, const tsip_message_t *msg)
{
TSIP_TRANSAC_SYNC_BEGIN(self);
switch(type)
{
case tsip_transac_incoming_msg:
{
if(msg && TSIP_MESSAGE_IS_REQUEST(msg))
{
tsip_transac_nistContext_sm_recv_request(&(TSIP_TRANSAC_NIST(self)->_fsm), msg);
}
break;
}
case tsip_transac_outgoing_msg:
{
if(msg && TSIP_MESSAGE_IS_RESPONSE(msg))
{
}
break;
}
case tsip_transac_canceled:
{
break;
}
case tsip_transac_terminated:
{
break;
}
case tsip_transac_timedout:
{
break;
}
case tsip_transac_error:
{
break;
}
case tsip_transac_transport_error:
{
break;
}
}
TSIP_TRANSAC_SYNC_END(self);
return 0;
}
int tsip_transac_nist_timer_callback(const tsip_transac_nist_t* self, tsk_timer_id_t timer_id)
{
int ret = -1;
if(self)
{
TSIP_TRANSAC_SYNC_BEGIN(self);
TSIP_TRANSAC_SYNC_END(self);
}
return ret;
}
void tsip_transac_nist_init(tsip_transac_nist_t *self)
{
/* Initialize the state machine.
*/
tsip_transac_nistContext_Init(&self->_fsm, self);
/* Set callback function to call when new messages arrive or errors happen in
the transport layer.
*/
TSIP_TRANSAC(self)->callback = tsip_transac_nist_event_callback;
#if defined(_DEBUG) || defined(DEBUG)
setDebugFlag(&(self->_fsm), DEBUG_STATE_MACHINE);
#endif
self->timerJ.timeout = TSIP_TRANSAC(self)->reliable ? 0 : TSIP_TIMER_GET(J); /* RFC 3261 - 17.2.2*/
}
int tsip_transac_nist_start(tsip_transac_nist_t *self)
@ -40,32 +172,131 @@ int tsip_transac_nist_start(tsip_transac_nist_t *self)
return -1;
}
void tsip_transac_nist_Trying_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_message_t* msg)
/* Started --> (INCOMING REQUEST) --> Trying
*/
void tsip_transac_nist_Started_2_Trying_X_recv_request(tsip_transac_nist_t *self, const tsip_request_t* request)
{
TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_msg, request);
}
void tsip_transac_nist_Trying_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_message_t* msg)
void tsip_transac_nist_Trying_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_request_t* request)
{
}
void tsip_transac_nist_Proceeding_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_message_t* msg)
void tsip_transac_nist_Trying_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_request_t* request)
{
}
void tsip_transac_nist_Proceeding_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_message_t* msg)
void tsip_transac_nist_Proceeding_2_Proceeding_X_send_1xx(tsip_transac_nist_t *self, const tsip_request_t* request)
{
}
void tsip_transac_nist_Proceeding_2_Proceeding_X_send_response(tsip_transac_nist_t *self, const tsip_message_t* msg)
void tsip_transac_nist_Proceeding_2_Completed_X_send_200_to_699(tsip_transac_nist_t *self, const tsip_request_t* request)
{
}
void tsip_transac_nist_Completed_2_Completed_X_send_response(tsip_transac_nist_t *self, const tsip_message_t* msg)
/* Proceeding -> (INCOMING REQUEST) -> Proceeding
*/
void tsip_transac_nist_Proceeding_2_Proceeding_X_recv_request(tsip_transac_nist_t *self, const tsip_request_t* request)
{
TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_msg, request);
}
/* Completed -> (INCOMING REQUEST) -> Completed
*/
void tsip_transac_nist_Completed_2_Completed_X_recv_request(tsip_transac_nist_t *self, const tsip_request_t* request)
{
TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_msg, request);
}
void tsip_transac_nist_Completed_2_Terminated_X_tirmerJ(tsip_transac_nist_t *self)
{
}
void tsip_transac_nist_Any_2_Terminated_X_transportError(tsip_transac_nist_t *self)
{
}
void tsip_transac_nist_OnTerminated(tsip_transac_nist_t *self)
{
}
}
//========================================================
// NIST object definition
//
static void* tsip_transac_nist_create(void * self, va_list * app)
{
tsip_transac_nist_t *transac = self;
if(transac)
{
const tsip_stack_handle_t *stack = va_arg(*app, const tsip_stack_handle_t *);
unsigned reliable = va_arg(*app, unsigned);
int32_t cseq_value = va_arg(*app, int32_t);
const char *cseq_method = va_arg(*app, const char *);
const char *callid = va_arg(*app, const char *);
/* Initialize base class */
tsip_transac_init(TSIP_TRANSAC(transac), stack, tsip_nist, reliable, cseq_value, cseq_method, callid);
/* Initialize NICT object */
tsip_transac_nist_init(transac);
}
return self;
}
static void* tsip_transac_nist_destroy(void * self)
{
tsip_transac_nist_t *transac = self;
if(transac)
{
TSIP_TRANSAC(transac)->running = 0;
TSIP_RESPONSE_SAFE_FREE(transac->response);
/* DeInitialize base class */
tsip_transac_deinit(TSIP_TRANSAC(transac));
}
return self;
}
static int tsip_transac_nist_cmp(const void *t1, const void *t2)
{
return tsip_transac_cmp(t1, t2);
}
static const tsk_object_def_t tsip_transac_nist_def_s =
{
sizeof(tsip_transac_nist_t),
tsip_transac_nist_create,
tsip_transac_nist_destroy,
tsip_transac_nist_cmp,
};
const void *tsip_transac_nist_def_t = &tsip_transac_nist_def_s;

View File

@ -30,6 +30,8 @@
#include "tinysip/transports/tsip_transport_layer.h"
#include "tinysip/transactions/tsip_transac_layer.h"
#include "tinysip/dialogs/tsip_dialog_layer.h"
#include "tinysip/parsers/tsip_parser_message.h"
#include "tsk_thread.h"
@ -45,32 +47,73 @@ static int tsip_transport_layer_stream_data_read(const tsip_transport_layer_t *s
*/
static int tsip_transport_layer_dgram_data_read(const tsip_transport_layer_t *self, const void* data, size_t size)
{
int ret = -1;
tsip_ragel_state_t state;
tsip_message_t *message = TSIP_MESSAGE_CREATE();
tsip_message_t *message = 0;
tsip_ragel_state_init(&state, data, size);
if(tsip_message_parse(&state, message) == TSIP_TRUE && message->firstVia && message->CSeq)
if(tsip_message_parse(&state, &message) == TSIP_TRUE
&& message->firstVia && message->Call_ID && message->CSeq && message->From && message->To)
{
const tsip_transac_layer_t *layer_transac = tsip_stack_get_transac_layer(self->stack);
if(layer_transac)
{
const tsip_transac_t *transac = tsip_transac_layer_find_client(layer_transac, message->firstVia->branch, message->CSeq->method);
if(transac)
{
//if(transac->callback)
{
transac->callback(transac, tsip_transac_msg, message);
}
}
else
{
/* Look into dialog layer */
}
const tsip_dialog_layer_t *layer_dialog = tsip_stack_get_dialog_layer(self->stack);
if((ret=tsip_transac_layer_handle_msg(layer_transac, 1, message)))
{ /* NO MATCHING TRANSACTION FOUND ==> LOOK INTO DIALOG LAYER */
ret = tsip_dialog_layer_handle_msg(layer_dialog, message);
}
//if(layer_transac)
//{
// if(TSIP_MESSAGE_IS_RESPONSE(message))
// {
// /* Look into transaction layer
// */
// const tsip_transac_t *transac = tsip_transac_layer_find_client(layer_transac, TSIP_MESSAGE_AS_RESPONSE(message));
// if(transac)
// {
// transac->callback(transac, tsip_transac_msg, message);
// }
//
// /* Look into dialog layer
// */
// else
// {
// }
// }
// else
// {
// /* Look into transaction layer
// */
// const tsip_transac_t *transac = tsip_transac_layer_find_server(layer_transac, TSIP_MESSAGE_AS_REQUEST(message));
// if(transac)
// {
// transac->callback(transac, tsip_transac_msg, message);
// }
// /* Look into dialog layer
// */
// else
// {
// const tsip_dialog_t *dialog = tsip_dialog_layer_find(layer_dialog, message->Call_ID->value, message->To->tag, message->From->tag);
// if(dialog)
// {
// dialog->callback(dialog, tsip_dialog_msg, message);
// }
// else
// {
// /*
// */
// const tsip_transac_t *transac = tsip_transac_layer_new(tsip_transac_layer_t *self, const tsip_message_t* msg)
// }
// }
// }
//}
}
TSIP_MESSAGE_SAFE_FREE(message);
return 0;
return ret;
}
tsip_transport_t* tsip_transport_layer_find(const tsip_transport_layer_t* self, tnet_socket_type_t type)

View File

@ -95,6 +95,7 @@ int tsip_message_add_header(tsip_message_t *self, const tsip_header_t *hdr)
ADD_HEADER(Call_ID, Call_ID);
ADD_HEADER(CSeq, CSeq);
ADD_HEADER(Expires, Expires);
ADD_HEADER(Content_Type, Content_Type);
ADD_HEADER(Content_Length, Content_Length);
default: break;
@ -274,7 +275,9 @@ int tsip_message_tostring(const tsip_message_t *self, tsk_buffer_t *output)
if(self->CSeq) tsip_header_tostring(TSIP_HEADER(self->CSeq), output);
/* Expires */
if(self->Expires) tsip_header_tostring(TSIP_HEADER(self->Expires), output);
/* Content Length*/
/* Content-Type */
if(self->Content_Type) tsip_header_tostring(TSIP_HEADER(self->Content_Type), output);
/* Content-Length*/
if(self->Content_Length) tsip_header_tostring(TSIP_HEADER(self->Content_Length), output);
/* All other headers */
@ -290,13 +293,15 @@ int tsip_message_tostring(const tsip_message_t *self, tsk_buffer_t *output)
/* EMPTY LINE */
tsk_buffer_append(output, "\r\n", 2);
/* CONTENT */
if(TSIP_MESSAGE_HAS_CONTENT(self))
{
tsk_buffer_append(output, TSK_BUFFER_TO_STRING(self->Content), TSK_BUFFER_SIZE(self->Content));
}
return 0;
}
/*========================================================
* Request
*/
tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_uri, const tsip_uri_t *from, const tsip_uri_t *to, const char *call_id, int32_t cseq)
{
tsip_request_t* request;
@ -333,6 +338,21 @@ tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_u
return request;
}
tsip_response_t *tsip_response_new(short status_code, const char* reason_phrase, const tsip_request_t *request)
{
tsip_response_t *response = 0;
if(request)
{
response = TSIP_RESPONSE_CREATE(request, status_code, reason_phrase);
TSIP_MESSAGE_ADD_HEADER(response, TSIP_HEADER_USER_AGENT_VA_ARGS(TSIP_HEADER_USER_AGENT_DEFAULT)); /* To be compliant with OMA SIMPLE IM v1.0*/
/*
Copy other headers
*/
}
return response;
}
@ -354,6 +374,8 @@ static void* tsip_message_create(void *self, va_list * app)
if(message)
{
message->type = va_arg(*app, tsip_message_type_t);
message->headers = TSK_LIST_CREATE();
switch(message->type)
{
case tsip_unknown:
@ -378,14 +400,47 @@ static void* tsip_message_create(void *self, va_list * app)
#endif
message->line_status.reason_phrase = tsk_strdup(va_arg(*app, const char*));
/* TODO: copy headers */
/*
RFC 3261 - 8.2.6.2 Headers and Tags
The From field of the response MUST equal the From header field of
the request. The Call-ID header field of the response MUST equal the
Call-ID header field of the request. The CSeq header field of the
response MUST equal the CSeq field of the request. The Via header
field values in the response MUST equal the Via header field values
in the request and MUST maintain the same ordering.
If a request contained a To tag in the request, the To header field
in the response MUST equal that of the request. However, if the To
header field in the request did not contain a tag, the URI in the To
header field in the response MUST equal the URI in the To header
field; additionally, the UAS MUST add a tag to the To header field in
the response (with the exception of the 100 (Trying) response, in
which a tag MAY be present). This serves to identify the UAS that is
responding, possibly resulting in a component of a dialog ID. The
same tag MUST be used for all responses to that request, both final
and provisional (again excepting the 100 (Trying)). Procedures for
the generation of tags are defined in Section 19.3.
*/
message->From = tsk_object_ref((void*)request->From);
message->Call_ID = tsk_object_ref((void*)request->Call_ID);
message->CSeq = tsk_object_ref((void*)request->CSeq);
message->firstVia = tsk_object_ref((void*)request->firstVia);
/* All other VIAs */
{
size_t index = 0;
const tsip_header_t * via;
while((via = tsip_message_get_headerAt(request, tsip_htype_Via, index++)))
{
tsip_message_add_header(message, via);
}
}
message->To = tsk_object_ref((void*)request->To);
// FIXME: What about record routes?
break;
}
}
message->headers = TSK_LIST_CREATE();
}
else
{
@ -416,12 +471,14 @@ static void* tsip_message_destroy(void *self)
tsk_object_unref(message->Call_ID);
tsk_object_unref(message->Contact);
tsk_object_unref(message->Content_Length);
tsk_object_unref(message->Content_Type);
tsk_object_unref(message->CSeq);
tsk_object_unref(message->firstVia);
tsk_object_unref(message->From);
tsk_object_unref(message->Expires);
tsk_object_unref(message->To);
TSK_BUFFER_SAFE_FREE(message->Content);
TSK_LIST_SAFE_FREE(message->headers);
}

View File

@ -60,26 +60,49 @@
"Contact: <sip:mamadou@192.168.0.11:63140>;expires=3600;q=1.0,<sip:mamadou@192.168.0.11:56717>;expires=3600;q=1.0\r\n" \
"Contact: <sip:mamadou@127.0.0.1:5060>;expires=3600;q=1.0\r\n" \
"Contact: <sip:mamadou@127.0.0.1>;expires=3600;q=1.0\r\n" \
"P-Preferred-Identity: <sip:mamadou@ims-network.com>\r\n" \
"P-Access-Network-Info: 3GPP-UTRAN-TDD;utran-cell-id-3gpp=00000000\r\n" \
"Authorization: Digest username=\"Alice\", realm=\"atlanta.com\",nonce=\"84a4cc6f3082121f32b42a2187831a9e\",response=\"7587245234b3434cc3412213e5f113a5432,test=123\"\r\n" \
"Privacy: none;user;id\r\n" \
"Proxy-Authenticate: Digest realm=\"atlanta.com\",domain=\"sip:ss1.carrier.com\",qop=\"auth,auth-int\",nonce=\"f84f1cec41e6cbe5aea9c8e88d359\",opaque=\"\", stale=FALSE, algorithm=MD5,test=124\r\n" \
"Authorization: Digest username=\"bob\", realm=\"atlanta.example.com\",nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\", opaque=\"\",uri=\"sips:ss2.biloxi.example.com\",test=\"7854\",response=\"dfe56131d1958046689d83306477ecc\"\r\n" \
"Proxy-Authorization: Digest username=\"Alice\", test=666,realm=\"atlanta.com\",nonce=\"c60f3082ee1212b402a21831ae\",response=\"245f23415f11432b3434341c022\"\r\n" \
"WWW-Authenticate: Digest realm=\"atlanta.com\",domain=\"sip:boxesbybob.com\", qop=\"auth\",nonce=\"f84f1cec41e6cbe5aea9c8e88d359\",opaque=\"\",stale=FALSE,algorithm=MD5,test=\"3\"\r\n" \
"l: 0\r\n" \
"\r\n"
#define SIP_MESSAGE \
"MESSAGE sip:mamadou@micromethod.com SIP/2.0\r\n" \
"Via: SIP/2.0/UDP 192.168.0.11:64163;rport;branch=z9hG4bK1262758946486\r\n" \
"Route: <sip:192.168.0.15:5060;lr=true;transport=udp\r\n" \
"From: <sip:bob@micromethod.com>;tag=mercuro\r\n" \
"To: <sip:mamadou@micromethod.com>\r\n" \
"Call-ID: 1262767804423\r\n" \
"CSeq: 8 MESSAGE\r\n" \
"Max-Forwards: 70\r\n" \
"Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER\r\n" \
"User-Agent: IM-client/OMA1.0 Mercuro-Bronze/v4.0.1508.0\r\n" \
"c: text/plain; charset=utf-8\r\n" \
"P-Preferred-Identity: <sip:bob@micromethod.com\r\n" \
"Allow-Events: presence, presence.winfo\r\n" \
"Content-Length: 11\r\n" \
"\r\n" \
"How are you"
#define SIP_MSG_2_TEST SIP_MESSAGE
void test_parser()
{
tsip_ragel_state_t state;
tsip_message_t *message = TSIP_MESSAGE_CREATE();
tsip_message_t *message = 0;
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
TSIP_BOOLEAN enabled;
int32_t expires;
uint32_t clength;
tsip_ragel_state_init(&state, SIP_RESPONSE, strlen(SIP_RESPONSE));
tsip_message_parse(&state, message);
tsip_ragel_state_init(&state, SIP_MSG_2_TEST, strlen(SIP_MSG_2_TEST));
tsip_message_parse(&state, &message);
enabled = tsip_message_allowed(message, "REFER");
enabled = tsip_message_allowed(message, "MESSAGE");
@ -125,13 +148,36 @@ void test_requests()
void test_responses()
{
tsip_ragel_state_t state;
tsip_request_t *request = 0;
tsip_request_t *response = 0;
tsip_ragel_state_init(&state, SIP_MESSAGE, strlen(SIP_MESSAGE));
tsip_message_parse(&state, &request);
/* Create the response and destroy the request */
response = tsip_response_new(200, "OK you can move forward", request);
TSIP_REQUEST_SAFE_FREE(request);
{
/* DUMP the response */
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
tsip_message_tostring(response, buffer);
TSK_DEBUG_INFO("Response=\n%s", TSK_BUFFER_TO_STRING(buffer));
TSK_BUFFER_SAFE_FREE(buffer);
}
TSIP_RESPONSE_SAFE_FREE(response);
}
void test_messages()
{
test_parser();
//test_parser();
//test_requests();
test_responses();
}

View File

@ -794,6 +794,10 @@
<Filter
Name="smc"
>
<File
RelativePath=".\source\smc\tsip_dialog_message_sm.c"
>
</File>
<File
RelativePath=".\source\smc\tsip_dialog_register_sm.c"
>
@ -846,6 +850,10 @@
RelativePath=".\source\dialogs\tsip_dialog_layer.c"
>
</File>
<File
RelativePath=".\source\dialogs\tsip_dialog_message.c"
>
</File>
<File
RelativePath=".\source\dialogs\tsip_dialog_register.client.c"
>
@ -1340,6 +1348,10 @@
<Filter
Name="smc"
>
<File
RelativePath=".\include\tinysip\smc\tsip_dialog_message_sm.h"
>
</File>
<File
RelativePath=".\include\tinysip\smc\tsip_dialog_register_sm.h"
>
@ -1388,6 +1400,10 @@
RelativePath=".\include\tinysip\dialogs\tsip_dialog_layer.h"
>
</File>
<File
RelativePath=".\include\tinysip\dialogs\tsip_dialog_message.h"
>
</File>
<File
RelativePath=".\include\tinysip\dialogs\tsip_dialog_register.h"
>
@ -1817,6 +1833,10 @@
<Filter
Name="smc"
>
<File
RelativePath=".\smc\tsip_dialog_message.sm"
>
</File>
<File
RelativePath=".\smc\tsip_dialog_register.sm"
>