Add tinySDP project.

tinySDP is responsible for SDP (RFC 4566) message parsing.
This commit is contained in:
bossiel 2010-03-13 06:27:01 +00:00
parent 8842591ee4
commit 634441a5a3
70 changed files with 11035 additions and 0 deletions

View File

@ -0,0 +1,42 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; RFC 5234 - ABNF CORE RULES
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OCTET= %x00-FF ; 8 bits of data
CHAR= %x01-7F ; any 7-bit US-ASCII character, excluding NUL
VCHAR= %x21-7E ; visible (printing) characters
ALPHA= %x41-5A / %x61-7A ; A-Z / a-z
DIGIT= %x30-39 ; 0-9
CTL= %x00-1F / %x7F ; any US-ASCII control character: ; (octets 0 - 31) and DEL (127)
HTAB= %x09 ; horizontal tab
LF= %x0A ; linefeed
CR= %x0D ; carriage return
SP= %x20 ; space
DQUOTE= %x22 ; " (Double Quote)
BIT= "0" / "1"
HEXDIG= DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
CRLF= CR LF ; Internet standard newline
WSP= SP / HTAB ; white space
LWSP= *(WSP / CRLF WSP) ; linear white space (past newline)
;---------------------------------------------------------------------------------------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; RFC 4566 - SDP ABNF
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -0,0 +1,117 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header.h
* @brief Defines a SDP header/line (<type>=<value>).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYSDP_HEADER_H
#define TINYSDP_HEADER_H
#include "tinysdp_config.h"
#include "tsk_ragel_state.h"
#include "tsk_list.h"
TSDP_BEGIN_DECLS
#define TSDP_HEADER(self) ((tsdp_header_t*)(self))
#define TSDP_HEADER_VALUE_TOSTRING_F(self) ((tsdp_header_value_tostring_f)(self))
typedef int (*tsdp_header_value_tostring_f)(const struct tsdp_header_s* header, tsk_buffer_t* output);
#define TSDP_HTYPE_V_RANK 0
#define TSDP_HTYPE_O_RANK 1
#define TSDP_HTYPE_S_RANK 2
#define TSDP_HTYPE_I_RANK 3
#define TSDP_HTYPE_U_RANK 4
#define TSDP_HTYPE_E_RANK 5
#define TSDP_HTYPE_P_RANK 6
//#define TSDP_HTYPE_C_RANK 7
//#define TSDP_HTYPE_B_RANK 8
#define TSDP_HTYPE_Z_RANK 9
#define TSDP_HTYPE_K_RANK 10
#define TSDP_HTYPE_A_RANK 11
#define TSDP_HTYPE_T_RANK 12
#define TSDP_HTYPE_R_RANK 13
#define TSDP_HTYPE_M_RANK 14
//#define TSDP_HTYPE_I_RANK 15
#define TSDP_HTYPE_C_RANK 16
#define TSDP_HTYPE_B_RANK 17
#define TSDP_HTYPE_DUMMY_RANK 255
/**
* @enum tsdp_header_type_e
*
* @brief List of all supported headers.
**/
typedef enum tsdp_header_type_e
{
tsdp_htype_A,
tsdp_htype_B,
tsdp_htype_C,
tsdp_htype_Dummy,
tsdp_htype_E,
tsdp_htype_I,
tsdp_htype_K,
tsdp_htype_M,
tsdp_htype_O,
tsdp_htype_P,
tsdp_htype_R,
tsdp_htype_S,
tsdp_htype_T,
tsdp_htype_U,
tsdp_htype_V,
tsdp_htype_Z
}
tsdp_header_type_t;
/*================================
*/
typedef struct tsdp_header_s
{
TSK_DECLARE_OBJECT;
tsdp_header_type_t type;
//! Because all SDP headers shall appear in a fixed order, the rank is used to place each header.
// Info: RFC 4566 - 5. SDP Specification.
uint8_t rank;
tsdp_header_value_tostring_f tostring;
}
tsdp_header_t;
#define TSDP_DECLARE_HEADER tsdp_header_t header
typedef tsk_list_t tsdp_headers_L_t; /**< List of @ref tsdp_header_t elements. */
/*
================================*/
int tsdp_header_rank_cmp(const tsdp_header_t*, const tsdp_header_t*);
TINYSDP_API char tsdp_header_get_name(tsdp_header_type_t type);
TINYSDP_API char tsdp_header_get_nameex(const tsdp_header_t *self);
TINYSDP_API int tsdp_header_tostring(const tsdp_header_t *self, tsk_buffer_t *output);
TSDP_END_DECLS
#endif /* TINYSDP_HEADER_H */

View File

@ -0,0 +1,74 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_B.h
* @brief SDP "b=" header (Bandwidth).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_B_H_
#define _TSDP_HEADER_B_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_B_CREATE
* Creates new sdp B header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_B_VA_ARGS(bwtype, bandwidth) tsdp_header_B_def_t, (const char*)bwtype, (uint32_t)bandwidth
#define TSDP_HEADER_B_CREATE(bwtype, bandwidth) tsk_object_new(TSDP_HEADER_B_VA_ARGS(bwtype, bandwidth))
#define TSDP_HEADER_B_CREATE_NULL() TSDP_HEADER_B_CREATE(TSDP_NULL, TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "b=" header (Bandwidth).
///
/// @par ABNF : b=<bwtype> HCOLON <bandwidth>
/// bwtype = token
/// bandwidth = 1*DIGIT
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_B_s
{
TSDP_DECLARE_HEADER;
char* bwtype;
uint32_t bandwidth;
}
tsdp_header_B_t;
typedef tsk_list_t tsdp_headers_B_L_t;
tsdp_header_B_t *tsdp_header_B_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_B_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_I_H_ */

View File

@ -0,0 +1,79 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_C.h
* @brief SDP "c=" header (Connection Data).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_C_H_
#define _TSDP_HEADER_C_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_C_CREATE
* Creates new sdp "p=" header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_C_VA_ARGS(nettype, addrtype, addr) tsdp_header_C_def_t, (const char*)nettype, (const char*)addrtype, (const char*)addr
#define TSDP_HEADER_C_CREATE(nettype, addrtype, addr) tsk_object_new(TSDP_HEADER_C_VA_ARGS(nettype, addrtype, addr))
#define TSDP_HEADER_C_CREATE_NULL() TSDP_HEADER_C_CREATE(TSDP_NULL, TSDP_NULL, TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "c=" header (Connection Data).
/// A session description MUST contain either at least one "c=" field in
/// each media description or a single "c=" field at the session level.
/// It MAY contain a single session-level "c=" field and additional "c="
/// field(s) per media description, in which case the per-media values
/// override the session-level settings for the respective media.
///
///
///
/// @par ABNF : c= nettype SP addrtype SP connection-address
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_C_s
{
TSDP_DECLARE_HEADER;
char* nettype;
char* addrtype;
char* addr;
}
tsdp_header_C_t;
typedef tsk_list_t tsdp_headers_C_L_t;
tsdp_header_C_t *tsdp_header_C_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_C_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_C_H_ */

View File

@ -0,0 +1,71 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_Dummy.h
* @brief SDP dummy header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_DUMMY_H_
#define _TSDP_HEADER_DUMMY_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_DUMMY_CREATE
* Creates new sdp Dummy header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_DUMMY_VA_ARGS(name, value) tsdp_header_Dummy_def_t, (char)name, (const char*)value
#define TSDP_HEADER_DUMMY_CREATE(name, value) tsk_object_new(TSDP_HEADER_DUMMY_VA_ARGS(name, value))
#define TSDP_HEADER_DUMMY_CREATE_NULL() TSDP_HEADER_DUMMY_CREATE(TSDP_NULL, TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP Dummy header.
///
/// @par ABNF : alpha SP* "=" SP*<: any*
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_Dummy_s
{
TSDP_DECLARE_HEADER;
char name;
char *value;
}
tsdp_header_Dummy_t;
typedef tsk_list_t tsdp_headers_Dummy_L_t;
tsdp_header_Dummy_t *tsdp_header_Dummy_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_Dummy_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_DUMMY_H_ */

View File

@ -0,0 +1,74 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_E.h
* @brief SDP "e=" header (Email Address).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_E_H_
#define _TSDP_HEADER_E_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_E_CREATE
* Creates new sdp E header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_E_VA_ARGS(value) tsdp_header_E_def_t, (const char*)value
#define TSDP_HEADER_E_CREATE(value) tsk_object_new(TSDP_HEADER_E_VA_ARGS(value))
#define TSDP_HEADER_E_CREATE_NULL() TSDP_HEADER_E_CREATE(TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "e=" header (Email Address).
///
/// The "e=" line specifies contact information for the person
/// responsible for the conference. This is not necessarily the same
/// person that created the conference announcement.
///
/// @par ABNF : e= email-address
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_E_s
{
TSDP_DECLARE_HEADER;
char* value;
}
tsdp_header_E_t;
typedef tsk_list_t tsdp_headers_E_L_t;
tsdp_header_E_t *tsdp_header_E_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_E_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_E_H_ */

View File

@ -0,0 +1,70 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_I.h
* @brief SDP "i=" header (Session Information).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_I_H_
#define _TSDP_HEADER_I_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_I_CREATE
* Creates new sdp I header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_I_VA_ARGS(value) tsdp_header_I_def_t, (const char*)value
#define TSDP_HEADER_I_CREATE(value) tsk_object_new(TSDP_HEADER_I_VA_ARGS(value))
#define TSDP_HEADER_I_CREATE_NULL() TSDP_HEADER_I_CREATE(TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "i=" header (Session Information).
///
/// @par ABNF : i=text
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_I_s
{
TSDP_DECLARE_HEADER;
char* value;
}
tsdp_header_I_t;
typedef tsk_list_t tsdp_headers_I_L_t;
tsdp_header_I_t *tsdp_header_I_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_I_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_I_H_ */

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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_K.h
* @brief SDP "k=" header (Encryption Key).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_K_H_
#define _TSDP_HEADER_K_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_K_CREATE
* Creates new sdp "k=" header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_K_VA_ARGS(value) tsdp_header_K_def_t, (const char*)value
#define TSDP_HEADER_K_CREATE(value) tsk_object_new(TSDP_HEADER_K_VA_ARGS(value))
#define TSDP_HEADER_K_CREATE_NULL() TSDP_HEADER_K_CREATE(TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "k=" header (Encryption Key).
///
///
/// @par ABNF : k= key-type
/// key-type = "prompt" / "clear:" text / "base64:" base64 / "uri:" uri
/// base64 = *base64-unit [base64-pad]
/// base64-unit = 4base64-char
/// base64-pad = 2base64-char "==" / 3base64-pad "="
/// base64-char = ALPHA / DIGIT / "+" / "/"
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_K_s
{
TSDP_DECLARE_HEADER;
char* value;
}
tsdp_header_K_t;
typedef tsk_list_t tsdp_headers_K_L_t;
tsdp_header_K_t *tsdp_header_K_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_K_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_P_H_ */

View File

@ -0,0 +1,121 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_O.h
* @brief SDP "o=" header (Origin).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Oat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_O_H_
#define _TSDP_HEADER_O_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_O_CREATE
* Creates new sdp O header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_O_VA_ARGS(username, sess_id, sess_version, nettype, addrtype, addr) tsdp_header_O_def_t, (const char*)username, (uint32_t)sess_version, (uint32_t)sess_id, (const char*)nettype, (const char*)addrtype, (const char*)addr
#define TSDP_HEADER_O_VA_ARGS_DEFAULT(username, nettype, addrtype, addr) TSDP_HEADER_O_VA_ARGS(username, TSDP_HEADER_O_SESS_ID_DEFAULT, TSDP_HEADER_O_SESS_VERSION_DEFAULT, nettype, addrtype, addr)
#define TSDP_HEADER_O_CREATE(username, sess_id, sess_version, nettype, addrtype, addr) tsk_object_new(TSDP_HEADER_O_VA_ARGS(username, sess_id, sess_version, nettype, addrtype, addr))
#define TSDP_HEADER_O_CREATE_NULL() TSDP_HEADER_O_CREATE(TSDP_NULL, 0, 0, TSDP_NULL, TSDP_NULL, TSDP_NULL)
#define TSDP_HEADER_O_CREATE_DEFAULT(username, nettype, addrtype, addr) TSDP_HEADER_O_CREATE(username, TSDP_HEADER_O_SESS_ID_DEFAULT, TSDP_HEADER_O_SESS_VERSION_DEFAULT, nettype, addrtype, addr)
#define TSDP_HEADER_O_SESS_ID_DEFAULT 123456
#define TSDP_HEADER_O_SESS_VERSION_DEFAULT 678901
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "o=" header (Origin).
/// The "o=" field gives the originator of the session (her username and
/// the address of the user's host) plus a session identifier and version number.
///
/// @par ABNF : u=username SP
/// sess-id SP sess-version SP nettype SP addrtype SP unicast-address
///
/// username = non-ws-string
/// sess-id = 1*DIGIT
/// sess-version = 1*DIGIT
/// nettype = token
/// addrtype = token
/// unicast-address = FQDN
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_O_s
{
TSDP_DECLARE_HEADER;
/** <username> is the user's login on the originating host, or it is "-"
if the originating host does not support the concept of user IDs.
The <username> MUST NOT contain spaces.*/
char* username;
/** <sess-id>, <nettype>, <addrtype>, and <unicast-address> forms a
globally unique identifier for the session. The method of
<sess-id> allocation is up to the creating tool, but it has been
suggested that a Network Time Protocol (NTP) format timestamp be
used to ensure uniqueness*/
uint32_t sess_id;
/** <sess-version> is a version number for this session description. Its
usage is up to the creating tool, so long as <sess-version> is
increased when a modification is made to the session data. Again,
it is RECOMMENDED that an NTP format timestamp is used.*/
uint32_t sess_version;
/** <nettype> is a text string giving the type of network. Initially
"IN" is defined to have the meaning "Internet", but other values
MAY be registered in the future (see Section 8 of RFC 4566)*/
char* nettype;
/**<addrtype> is a text string giving the type of the address that
follows. Initially "IP4" and "IP6" are defined, but other values
MAY be registered in the future (see Section 8 of RFC 4566)*/
char* addrtype;
/** <unicast-address> is the address of the machine from which the
session was created. For an address type of IP4, this is either
the fully qualified domain name of the machine or the dotted-
decimal representation of the IP version 4 address of the machine.
For an address type of IP6, this is either the fully qualified
domain name of the machine or the compressed textual
representation of the IP version 6 address of the machine. For
both IP4 and IP6, the fully qualified domain name is the form that
SHOULD be given unless this is unavailable, in which case the
globally unique address MAY be substituted. A local IP address
MUST NOT be used in any context where the SDP description might
leave the scope in which the address is meaningful (for example, a
local address MUST NOT be included in an application-level
referral that might leave the scope)*/
char* addr;
}
tsdp_header_O_t;
tsdp_header_O_t *tsdp_header_O_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_O_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_O_H_ */

View File

@ -0,0 +1,74 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_P.h
* @brief SDP "p=" header (Phone Number).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_P_H_
#define _TSDP_HEADER_P_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_P_CREATE
* Creates new sdp "p=" header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_P_VA_ARGS(value) tsdp_header_P_def_t, (const char*)value
#define TSDP_HEADER_P_CREATE(value) tsk_object_new(TSDP_HEADER_P_VA_ARGS(value))
#define TSDP_HEADER_P_CREATE_NULL() TSDP_HEADER_P_CREATE(TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "p=" header (Phone Number).
/// The "p=" line specifies contact information for the person
/// responsible for the conference. This is not necessarily the same
/// person that created the conference announcement.
///
///
/// @par ABNF : p= phone-number
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_P_s
{
TSDP_DECLARE_HEADER;
char* value;
}
tsdp_header_P_t;
typedef tsk_list_t tsdp_headers_P_L_t;
tsdp_header_P_t *tsdp_header_P_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_P_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_P_H_ */

View File

@ -0,0 +1,80 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_R.h
* @brief SDP "r=" header (Repeat Times).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_R_H_
#define _TSDP_HEADER_R_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
#include "tsk_string.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_R_CREATE
* Creates new sdp R header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_R_VA_ARGS() tsdp_header_R_def_t
#define TSDP_HEADER_R_CREATE() tsk_object_new(TSDP_HEADER_R_VA_ARGS())
#define TSDP_HEADER_R_CREATE_NULL() TSDP_HEADER_R_CREATE()
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "r=" header (Repeat Times).
///
/// The "e=" line "r=" fields specify repeat times for a session.
///
/// @par ABNF : r= repeat-interval SP typed-time 1*(SP typed-time)
/// repeat-interval = POS-DIGIT *DIGIT [fixed-len-time-unit]
/// typed-time = 1*DIGIT [fixed-len-time-unit]
/// 1*DIGIT [fixed-len-time-unit]
/// fixed-len-time-unit = "d" / "h" / "m" / "s"
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_R_s
{
TSDP_DECLARE_HEADER;
char* repeat_interval;
char* typed_time;
tsk_strings_L_t* typed_times;
}
tsdp_header_R_t;
typedef tsk_list_t tsdp_headers_R_L_t;
tsdp_header_R_t *tsdp_header_R_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_R_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_R_H_ */

View File

@ -0,0 +1,68 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_S.h
* @brief SDP "s=" header (Session Name).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_S_H_
#define _TSDP_HEADER_S_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_S_CREATE
* Creates new sdp S header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_S_VA_ARGS(value) tsdp_header_S_def_t, (const char*)value
#define TSDP_HEADER_S_CREATE(value) tsk_object_new(TSDP_HEADER_S_VA_ARGS(value))
#define TSDP_HEADER_S_CREATE_NULL() TSDP_HEADER_S_CREATE(TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "s=" header (Session Name).
///
/// @par ABNF : s=text
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_S_s
{
TSDP_DECLARE_HEADER;
char* value;
}
tsdp_header_S_t;
tsdp_header_S_t *tsdp_header_S_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_S_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_S_H_ */

View File

@ -0,0 +1,84 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_T.h
* @brief SDP "t=" header (Timing).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_T_H_
#define _TSDP_HEADER_T_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
#include "tinySDP/headers/tsdp_header_R.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_T_CREATE
* Creates new sdp "t=" header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_T_VA_ARGS(start, stop) tsdp_header_T_def_t, (uint64_t)start, (uint64_t)stop
#define TSDP_HEADER_T_CREATE(start, stop) tsk_object_new(TSDP_HEADER_T_VA_ARGS(start, stop))
#define TSDP_HEADER_T_CREATE_NULL() TSDP_HEADER_T_CREATE(0, 0)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "t=" header (Timing).
/// The "t=" lines specify the start and stop times for a session.
/// Multiple "t=" lines MAY be used if a session is active at multiple
/// irregularly spaced times; each additional "t=" line specifies an
/// additional period of time for which the session will be active. If
/// the session is active at regular times, an "r=" line (see below)
/// should be used in addition to, and following, a "t=" line -- in which
/// case the "t=" line specifies the start and stop times of the repeat
/// sequence.
///
///
/// @par ABNF : t= start-time SP stop-time *( CRLF repeat-fields )
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_T_s
{
TSDP_DECLARE_HEADER;
uint64_t start;
uint64_t stop;
tsdp_headers_R_L_t* repeat_fields;
}
tsdp_header_T_t;
typedef tsk_list_t tsdp_headers_T_L_t;
tsdp_header_T_t *tsdp_header_T_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_T_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_P_H_ */

View File

@ -0,0 +1,70 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_U.h
* @brief SDP "u=" header (URI).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Uat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_U_H_
#define _TSDP_HEADER_U_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_U_CREATE
* Creates new sdp U header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_U_VA_ARGS(value) tsdp_header_U_def_t, (const char*)value
#define TSDP_HEADER_U_CREATE(value) tsk_object_new(TSDP_HEADER_U_VA_ARGS(value))
#define TSDP_HEADER_U_CREATE_NULL() TSDP_HEADER_U_CREATE(TSDP_NULL)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "u=" header (URI).
///
/// @par ABNF : u=uri
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_U_s
{
TSDP_DECLARE_HEADER;
char* value;
}
tsdp_header_U_t;
typedef tsk_list_t tsdp_headers_U_L_t;
tsdp_header_U_t *tsdp_header_U_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_U_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_U_H_ */

View File

@ -0,0 +1,74 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_V.h
* @brief SDP "v=" header (Protocol Version).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_V_H_
#define _TSDP_HEADER_V_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_V_CREATE
* Creates new sdp V header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_V_VA_ARGS(version) tsdp_header_V_def_t, (int32_t)version
#define TSDP_HEADER_V_CREATE(version) tsk_object_new(TSDP_HEADER_V_VA_ARGS(version))
#define TSDP_HEADER_V_CREATE_NULL() TSDP_HEADER_V_CREATE(TSDP_HEADER_V_DEFAULT)
#define TSDP_HEADER_V_DEFAULT 0
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "v=" header (Protocol Version).
/// The "v=" field gives the version of the Session Description Protocol.
/// This memo (RFC 4566) defines version 0. There is no minor version number.
///
/// @par ABNF : v=1*DIGIT
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_V_s
{
TSDP_DECLARE_HEADER;
int32_t version;
}
tsdp_header_V_t;
typedef tsk_list_t tsdp_headers_V_L_t;
tsdp_header_V_t *tsdp_header_V_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_V_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_V_H_ */

View File

@ -0,0 +1,91 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_Z.h
* @brief SDP "z=" header (Time Zones).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TSDP_HEADER_Z_H_
#define _TSDP_HEADER_Z_H_
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
/**@def TSDP_HEADER_B_CREATE
* Creates new sdp Z header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSDP_HEADER_Z_VA_ARGS(time, shifted_back, typed_time) tsdp_header_Z_def_t, (uint64_t)time, (unsigned)shifted_back, (const char*)typed_time
#define TSDP_HEADER_Z_CREATE(time, shifted_back, typed_time) tsk_object_new(TSDP_HEADER_Z_VA_ARGS(time, shifted_back, typed_time))
#define TSDP_HEADER_Z_CREATE_NULL() TSDP_HEADER_Z_CREATE(0, 0, TSDP_NULL)
#define TSDP_ZONE_CREATE(time, shifted_back, typed_time) tsk_object_new(tsdp_zone_def_t, (uint64_t)time, (unsigned)shifted_back, (const char*)typed_time)
#define TSDP_ZONE_CREATE_NULL() TSDP_ZONE_CREATE(0, 0, TSDP_NULL)
typedef struct tsdp_zone_s
{
TSK_DECLARE_OBJECT;
uint64_t time;
unsigned shifted_back:1;
char* typed_time;
}
tsdp_zone_t;
typedef tsk_list_t tsdp_zones_L_t;
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SDP "z=" header (Time Zones).
///
/// @par ABNF : z=time SP ["-"] typed-time
/// *(SP time SP ["-"] typed-time)
/// time = POS-DIGIT 9*DIGIT
/// typed-time = 1*DIGIT [fixed-len-time-unit]
/// fixed-len-time-unit = "d" / "h" / "m" / "s"
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsdp_header_Z_s
{
TSDP_DECLARE_HEADER;
tsdp_zones_L_t* zones;
}
tsdp_header_Z_t;
typedef tsk_list_t tsdp_headers_Z_L_t;
tsdp_header_Z_t *tsdp_header_Z_parse(const char *data, size_t size);
TINYSDP_GEXTERN const void *tsdp_header_Z_def_t;
TINYSDP_GEXTERN const void *tsdp_zone_def_t;
TSDP_END_DECLS
#endif /* _TSDP_HEADER_Z_H_ */

View File

@ -0,0 +1,44 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_parser_message.h
* @brief SDP message parser.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYSDP_PARSER_MESSAGE_H
#define TINYSDP_PARSER_MESSAGE_H
#include "tinySDP_config.h"
#include "tinySDP/tsdp_message.h"
#include "tsk_ragel_state.h"
TSDP_BEGIN_DECLS
TINYSDP_API tsdp_message_t* tsdp_message_parse(const void *input, size_t size);
TSDP_END_DECLS
#endif /* TINYSDP_PARSER_MESSAGE_H */

View File

@ -0,0 +1,88 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_message.h
* @brief SDP message.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYSDP_MESSAGE_H
#define TINYSDP_MESSAGE_H
#include "tinySDP_config.h"
#include "tinySDP/headers/tsdp_header.h"
TSDP_BEGIN_DECLS
#define TSDP_MESSAGE_CREATE() tsk_object_new(tsdp_message_def_t)
typedef struct tsdp_message_s
{
TSK_DECLARE_OBJECT;
//! List of @ref tsdp_header_t elements.
tsdp_headers_L_t* headers;
}
tsdp_message_t;
TINYSDP_API int tsdp_message_add_header(tsdp_message_t *self, const tsdp_header_t *hdr);
TINYSDP_API int tsdp_message_add_headers(tsdp_message_t *self, const tsdp_headers_L_t *headers);
#if !defined(_MSC_VER) || defined(__GNUC__)
static void TSDP_MESSAGE_ADD_HEADER(tsdp_message_t *self, ...)
{
va_list ap;
tsdp_header_t *header;
const tsk_object_def_t *objdef;
va_start(ap, self);
objdef = va_arg(ap, const tsk_object_def_t*);
header = tsk_object_new2(objdef, &ap);
va_end(ap);
tsdp_message_add_header(self, header);
tsk_object_unref(header);
}
#else
#define TSDP_MESSAGE_ADD_HEADER(self, objdef, ...) \
{ \
tsdp_header_t *header = tsk_object_new(objdef, __VA_ARGS__); \
tsdp_message_add_header(self, header); \
tsk_object_unref(header); \
}
#endif
TINYSDP_API const tsdp_header_t *tsdp_message_get_headerAt(const tsdp_message_t *self, tsdp_header_type_t type, size_t index);
TINYSDP_API const tsdp_header_t *tsdp_message_get_header(const tsdp_message_t *self, tsdp_header_type_t type);
TINYSDP_API const tsdp_header_t *tsdp_message_get_headerByName(const tsdp_message_t *self, char name);
TINYSDP_API int tsdp_message_tostring(const tsdp_message_t *self, tsk_buffer_t *output);
TINYSDP_GEXTERN const void *tsdp_message_def_t;
TSDP_END_DECLS
#endif /* TINYSDP_MESSAGE_H */

View File

@ -0,0 +1,81 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYSDP_CONFIG_H
#define TINYSDP_CONFIG_H
#if HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef __SYMBIAN32__
#undef _WIN32 /* Because of WINSCW */
#endif
/* Windows (XP/Vista/7/CE and Windows Mobile) macro definition.
*/
#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE)
# define TSDP_UNDER_WINDOWS 1
#endif
#if (TSDP_UNDER_WINDOWS || defined(__SYMBIAN32__)) && defined(TINYSDP_EXPORTS)
# define TINYSDP_API __declspec(dllexport)
# define TINYSDP_GEXTERN __declspec(dllexport)
#elif (TSDP_UNDER_WINDOWS || defined(__SYMBIAN32__)) /*&& defined(TINYSDP_IMPORTS)*/
# define TINYSDP_API __declspec(dllimport)
# define TINYSDP_GEXTERN __declspec(dllimport)
#else
# define TINYSDP_API
# define TINYSDP_GEXTERN extern
#endif
/* Guards against C++ name mangling
*/
#ifdef __cplusplus
# define TSDP_BEGIN_DECLS extern "C" {
# define TSDP_END_DECLS }
#else
# define TSDP_BEGIN_DECLS
# define TSDP_END_DECLS
#endif
/* Disable some well-known warnings
*/
#ifdef _MSC_VER
# define _CRT_SECURE_NO_WARNINGS
#endif
/* Detecting C99 compilers
*/
#if (__STDC_VERSION__ == 199901L) && !defined(__C99__)
# define __C99__
#endif
#include <stdint.h>
#ifdef __SYMBIAN32__
#include <stdlib.h>
#endif
/* FIXME */
#define TSDP_NULL 0
#endif // TINYSDP_CONFIG_H

View File

@ -0,0 +1,40 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp.h
* @brief SDP (RFC 4566) implementations with both MMTel and PoC extensions.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYSDP_TSDP_H
#define TINYSDP_TSDP_H
#include "tinysdp_config.h"
TSDP_BEGIN_DECLS
TSDP_END_DECLS
#endif /* TINYSDP_TSDP_H */

59
trunk/tinySDP/ragel.sh Normal file
View File

@ -0,0 +1,59 @@
# Ragel generator
# For more information about Ragel: sdp://www.complang.org/ragel/
export OPTIONS="-C -L -T0"
#export OPTIONS="-C -L -G2"
# SDP Message parser
ragel.exe $OPTIONS -o ../src/parsers/tsdp_parser_message.c tsdp_parser_message.rl
# ==A
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_A.c tsdp_parser_header_A.rl
# ==B
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_B.c tsdp_parser_header_B.rl
# ==C
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_C.c tsdp_parser_header_C.rl
# ==Dummy
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_Dummy.c tsdp_parser_header_Dummy.rl
# ==E
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_E.c tsdp_parser_header_E.rl
# ==I
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_I.c tsdp_parser_header_I.rl
# ==K
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_K.c tsdp_parser_header_K.rl
# ==M
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_M.c tsdp_parser_header_M.rl
# ==O
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_O.c tsdp_parser_header_O.rl
# ==P
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_P.c tsdp_parser_header_P.rl
# ==R
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_R.c tsdp_parser_header_R.rl
# ==S
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_S.c tsdp_parser_header_S.rl
# ==T
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_T.c tsdp_parser_header_T.rl
# ==U
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_U.c tsdp_parser_header_U.rl
# ==V
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_V.c tsdp_parser_header_V.rl
# ==Z
ragel.exe $OPTIONS -o ../src/headers/tsdp_header_Z.c tsdp_parser_header_Z.rl

View File

@ -0,0 +1,77 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_machine_utils.rl
* @brief Ragel file.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
%%{
machine tsdp_machine_utils;
OCTET = "0x"[0-9A-Fa-f]+;
CHAR = 0x01..0x7f;
VCHAR = 0x21..0x7e;
ALPHA = 0x41..0x5a | 0x61..0x7a;
DIGIT = 0x30..0x39;
CTL = 0x00..0x1f | 0x7f;
HTAB = "\t";
LF = "\n";
CR = "\r";
SP = " ";
DQUOTE = "\"";
BIT = "0" | "1";
HEXDIG = DIGIT | "A"i | "B"i | "C"i | "D"i | "E"i | "F"i;
CRLF = CR LF;
WSP = SP | HTAB;
LWSP = ( WSP | ( CRLF WSP ) )*;
LWS = ( WSP* CRLF )? WSP+;
SWS = LWS?;
EQUAL = SWS "=" SWS;
LHEX = DIGIT | 0x61..0x66;
HCOLON = ( SP | HTAB )* ":" SWS;
separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\\" | DQUOTE | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HTAB;
STAR = SWS "*" SWS;
SLASH = SWS "/" SWS;
LPAREN = SWS "(" SWS;
RPAREN = SWS ")" SWS;
COMMA = SWS "," SWS;
SEMI = SWS ";" SWS;
COLON = SWS ":" SWS;
LAQUOT = SWS "<";
LDQUOT = SWS DQUOTE;
RAQUOT = ">" SWS;
RDQUOT = DQUOTE SWS;
UTF8_CONT = 0x80..0xbf;
UTF8_NONASCII = ( 0xc0..0xdf UTF8_CONT ) | ( 0xe0..0xef UTF8_CONT{2} ) | ( 0xf0..0xf7 UTF8_CONT{3} ) | ( 0xf8..0xfb UTF8_CONT{4} ) | ( 0xfc..0xfd UTF8_CONT{5} );
ctext = 0x21..0x27 | 0x2a..0x5b | 0x5d..0x7e | UTF8_NONASCII | LWS;
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 | "/" | "[" | "]" | "?" | "{" | "}" )+;
}%%

View File

@ -0,0 +1,168 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_B.c
* @brief SDP "b=" header (Bandwidth).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_B.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_B;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_bwtype{
TSK_PARSER_SET_STRING(hdr_B->bwtype);
}
action parse_bandwidth{
TSK_PARSER_SET_UINT(hdr_B->bandwidth);
}
action eob{
}
bwtype = token>tag %parse_bwtype;
bandwidth = DIGIT+>tag %parse_bandwidth;
B = 'b' SP* "=" SP*<: bwtype HCOLON bandwidth;
# Entry point
main := B :>CRLF @eob;
}%%
int tsdp_header_B_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_B_t *B = (const tsdp_header_B_t *)header;
return tsk_buffer_appendEx(output, "%s:%u",
B->bwtype,
B->bandwidth
);
}
return -1;
}
tsdp_header_B_t *tsdp_header_B_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_B_t *hdr_B = TSDP_HEADER_B_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"b=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_B);
}
return hdr_B;
}
//========================================================
// B header object definition
//
static void* tsdp_header_B_create(void *self, va_list * app)
{
tsdp_header_B_t *B = self;
if(B)
{
TSDP_HEADER(B)->type = tsdp_htype_B;
TSDP_HEADER(B)->tostring = tsdp_header_B_tostring;
TSDP_HEADER(B)->rank = TSDP_HTYPE_B_RANK;
B->bwtype = tsk_strdup(va_arg(*app, const char*));
B->bandwidth = va_arg(*app, uint32_t);
}
else{
TSK_DEBUG_ERROR("Failed to create new B header.");
}
return self;
}
static void* tsdp_header_B_destroy(void *self)
{
tsdp_header_B_t *B = self;
if(B){
TSK_FREE(B->bwtype);
}
else{
TSK_DEBUG_ERROR("Null B header.");
}
return self;
}
static int tsdp_header_B_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_B_def_s =
{
sizeof(tsdp_header_B_t),
tsdp_header_B_create,
tsdp_header_B_destroy,
tsdp_header_B_cmp
};
const void *tsdp_header_B_def_t = &tsdp_header_B_def_s;

View File

@ -0,0 +1,177 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_C.c
* @brief "c=" header (Connection Data).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_C.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_C;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_nettype{
TSK_PARSER_SET_STRING(hdr_C->nettype);
}
action parse_addrtype{
TSK_PARSER_SET_STRING(hdr_C->addrtype);
}
action parse_addr{
TSK_PARSER_SET_STRING(hdr_C->addr);
}
action eob{
}
nettype = any* >tag %parse_nettype;
addrtype = any* >tag %parse_addrtype;
addr = any* >tag %parse_addr;
C = 'c' SP* "=" SP*<: nettype :>SP addrtype :>SP addr;
# Entry point
main := C :>CRLF @eob;
}%%
int tsdp_header_C_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_C_t *C = (const tsdp_header_C_t *)header;
return tsk_buffer_appendEx(output, "%s %s %s",
C->nettype,
C->addrtype,
C->addr
);
return 0;
}
return -1;
}
tsdp_header_C_t *tsdp_header_C_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_C_t *hdr_C = TSDP_HEADER_C_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"c=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_C);
}
return hdr_C;
}
//========================================================
// E header object definition
//
static void* tsdp_header_C_create(void *self, va_list * app)
{
tsdp_header_C_t *C = self;
if(C)
{
TSDP_HEADER(C)->type = tsdp_htype_C;
TSDP_HEADER(C)->tostring = tsdp_header_C_tostring;
TSDP_HEADER(C)->rank = TSDP_HTYPE_C_RANK;
C->nettype = tsk_strdup(va_arg(*app, const char*));
C->addrtype = tsk_strdup(va_arg(*app, const char*));
C->addr = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_C_destroy(void *self)
{
tsdp_header_C_t *C = self;
if(C){
TSK_FREE(C->nettype);
TSK_FREE(C->addrtype);
TSK_FREE(C->addr);
}
else{
TSK_DEBUG_ERROR("Null P header.");
}
return self;
}
static int tsdp_header_C_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_C_def_s =
{
sizeof(tsdp_header_C_t),
tsdp_header_C_create,
tsdp_header_C_destroy,
tsdp_header_C_cmp
};
const void *tsdp_header_C_def_t = &tsdp_header_C_def_s;

View File

@ -0,0 +1,162 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_Dummy.c
* @brief SDP DUmmy header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_Dummy.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_Dummy;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_name{
hdr_Dummy->name = *tag_start;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_Dummy->value);
}
action eob{
}
Dummy = alpha>tag %parse_name SP* "=" SP*<: any*>tag %parse_value;
# Entry point
main := Dummy :>CRLF @eob;
}%%
int tsdp_header_Dummy_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_Dummy_t *Dummy = (const tsdp_header_Dummy_t *)header;
if(Dummy->value){
tsk_buffer_append(output, Dummy->value, strlen(Dummy->value));
}
return 0;
}
return -1;
}
tsdp_header_Dummy_t *tsdp_header_Dummy_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_Dummy_t *hdr_Dummy = TSDP_HEADER_DUMMY_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_OBJECT_SAFE_FREE(hdr_Dummy);
}
return hdr_Dummy;
}
//========================================================
// Dummy header object definition
//
static void* tsdp_header_Dummy_create(void *self, va_list * app)
{
tsdp_header_Dummy_t *Dummy = self;
if(Dummy)
{
TSDP_HEADER(Dummy)->type = tsdp_htype_Dummy;
TSDP_HEADER(Dummy)->tostring = tsdp_header_Dummy_tostring;
TSDP_HEADER(Dummy)->rank = TSDP_HTYPE_DUMMY_RANK;
Dummy->name = va_arg(*app, const char);
Dummy->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new Dummy header.");
}
return self;
}
static void* tsdp_header_Dummy_destroy(void *self)
{
tsdp_header_Dummy_t *Dummy = self;
if(Dummy){
TSK_FREE(Dummy->value);
}
else{
TSK_DEBUG_ERROR("Null Dummy header.");
}
return self;
}
static int tsdp_header_Dummy_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_Dummy_def_s =
{
sizeof(tsdp_header_Dummy_t),
tsdp_header_Dummy_create,
tsdp_header_Dummy_destroy,
tsdp_header_Dummy_cmp
};
const void *tsdp_header_Dummy_def_t = &tsdp_header_Dummy_def_s;

View File

@ -0,0 +1,159 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_I.c
* @brief SDP "i=" header (Session Information).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_E.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_E;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_E->value);
}
action eob{
}
E = 'e' SP* "=" SP*<: any*>tag %parse_value;
# Entry point
main := E :>CRLF @eob;
}%%
int tsdp_header_E_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_E_t *E = (const tsdp_header_E_t *)header;
if(E->value){
tsk_buffer_append(output, E->value, strlen(E->value));
}
return 0;
}
return -1;
}
tsdp_header_E_t *tsdp_header_E_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_E_t *hdr_E = TSDP_HEADER_E_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"e=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_E);
}
return hdr_E;
}
//========================================================
// E header object definition
//
static void* tsdp_header_E_create(void *self, va_list * app)
{
tsdp_header_E_t *E = self;
if(E)
{
TSDP_HEADER(E)->type = tsdp_htype_E;
TSDP_HEADER(E)->tostring = tsdp_header_E_tostring;
TSDP_HEADER(E)->rank = TSDP_HTYPE_E_RANK;
E->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_E_destroy(void *self)
{
tsdp_header_E_t *E = self;
if(E){
TSK_FREE(E->value);
}
else{
TSK_DEBUG_ERROR("Null E header.");
}
return self;
}
static int tsdp_header_E_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_E_def_s =
{
sizeof(tsdp_header_E_t),
tsdp_header_E_create,
tsdp_header_E_destroy,
tsdp_header_E_cmp
};
const void *tsdp_header_E_def_t = &tsdp_header_E_def_s;

View File

@ -0,0 +1,159 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_I.c
* @brief SDP "i=" header (Session Information).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_I.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_I;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_I->value);
}
action eob{
}
I = 'i' SP* "=" SP*<: any*>tag %parse_value;
# Entry point
main := I :>CRLF @eob;
}%%
int tsdp_header_I_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_I_t *I = (const tsdp_header_I_t *)header;
if(I->value){
tsk_buffer_append(output, I->value, strlen(I->value));
}
return 0;
}
return -1;
}
tsdp_header_I_t *tsdp_header_I_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_I_t *hdr_I = TSDP_HEADER_I_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"i=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_I);
}
return hdr_I;
}
//========================================================
// I header object definition
//
static void* tsdp_header_I_create(void *self, va_list * app)
{
tsdp_header_I_t *I = self;
if(I)
{
TSDP_HEADER(I)->type = tsdp_htype_I;
TSDP_HEADER(I)->tostring = tsdp_header_I_tostring;
TSDP_HEADER(I)->rank = TSDP_HTYPE_I_RANK;
I->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new I header.");
}
return self;
}
static void* tsdp_header_I_destroy(void *self)
{
tsdp_header_I_t *I = self;
if(I){
TSK_FREE(I->value);
}
else{
TSK_DEBUG_ERROR("Null I header.");
}
return self;
}
static int tsdp_header_I_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_I_def_s =
{
sizeof(tsdp_header_I_t),
tsdp_header_I_create,
tsdp_header_I_destroy,
tsdp_header_I_cmp
};
const void *tsdp_header_I_def_t = &tsdp_header_I_def_s;

View File

@ -0,0 +1,159 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_K.c
* @brief SDP "k=" header (Encryption Key).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_K.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_K;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_K->value);
}
action eob{
}
K = 'k' SP* "=" SP*<: any*>tag %parse_value;
# Entry point
main := K :>CRLF @eob;
}%%
int tsdp_header_K_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_K_t *K = (const tsdp_header_K_t *)header;
if(K->value){
tsk_buffer_append(output, K->value, strlen(K->value));
}
return 0;
}
return -1;
}
tsdp_header_K_t *tsdp_header_K_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_K_t *hdr_K = TSDP_HEADER_K_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"k=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_K);
}
return hdr_K;
}
//========================================================
// K header object definition
//
static void* tsdp_header_K_create(void *self, va_list * app)
{
tsdp_header_K_t *K = self;
if(K)
{
TSDP_HEADER(K)->type = tsdp_htype_K;
TSDP_HEADER(K)->tostring = tsdp_header_K_tostring;
TSDP_HEADER(K)->rank = TSDP_HTYPE_P_RANK;
K->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_K_destroy(void *self)
{
tsdp_header_K_t *K = self;
if(K){
TSK_FREE(K->value);
}
else{
TSK_DEBUG_ERROR("Null K header.");
}
return self;
}
static int tsdp_header_K_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_K_def_s =
{
sizeof(tsdp_header_K_t),
tsdp_header_K_create,
tsdp_header_K_destroy,
tsdp_header_K_cmp
};
const void *tsdp_header_K_def_t = &tsdp_header_K_def_s;

View File

@ -0,0 +1,200 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_O.c
* @brief SDP "o=" header (Origin).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Uat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_O.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_U;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_username{
TSK_PARSER_SET_STRING(hdr_O->username);
}
action parse_sess_id{
TSK_PARSER_SET_UINT(hdr_O->sess_id);
}
action parse_sess_version{
TSK_PARSER_SET_UINT(hdr_O->sess_version);
}
action parse_nettype{
TSK_PARSER_SET_STRING(hdr_O->nettype);
}
action parse_addrtype{
TSK_PARSER_SET_STRING(hdr_O->addrtype);
}
action parse_addr{
TSK_PARSER_SET_STRING(hdr_O->addr);
}
action eob{
}
username = any*>tag %parse_username;
sess_id = DIGIT+>tag %parse_sess_id;
sess_version = DIGIT+>tag %parse_sess_version;
nettype = any*>tag %parse_nettype;
addrtype = any*>tag %parse_addrtype;
addr = any*>tag %parse_addr;
O = 'o' SP* "=" SP*<: username :>SP sess_id :>SP sess_version :>SP nettype :>SP addrtype :>SP addr;
# Entry point
main := O :>CRLF @eob;
}%%
int tsdp_header_O_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_O_t *O = (const tsdp_header_O_t *)header;
// o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com
return tsk_buffer_appendEx(output, "%s %u %u %s %s %s",
O->username,
O->sess_version,
O->sess_id,
O->nettype,
O->addrtype,
O->addr
);
return 0;
}
return -1;
}
tsdp_header_O_t *tsdp_header_O_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_O_t *hdr_O = TSDP_HEADER_O_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"o=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_O);
}
return hdr_O;
}
//========================================================
// O header object definition
//
static void* tsdp_header_O_create(void *self, va_list * app)
{
tsdp_header_O_t *O = self;
if(O)
{
TSDP_HEADER(O)->type = tsdp_htype_O;
TSDP_HEADER(O)->tostring = tsdp_header_O_tostring;
TSDP_HEADER(O)->rank = TSDP_HTYPE_O_RANK;
O->username = tsk_strdup(va_arg(*app, const char*));
O->sess_version = va_arg(*app, uint32_t);
O->sess_id = va_arg(*app, uint32_t);
O->nettype = tsk_strdup(va_arg(*app, const char*));
O->addrtype = tsk_strdup(va_arg(*app, const char*));
O->addr = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new O header.");
}
return self;
}
static void* tsdp_header_O_destroy(void *self)
{
tsdp_header_O_t *O = self;
if(O){
TSK_FREE(O->username);
TSK_FREE(O->nettype);
TSK_FREE(O->addrtype);
TSK_FREE(O->addr);
}
else{
TSK_DEBUG_ERROR("Null U header.");
}
return self;
}
static int tsdp_header_O_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_O_def_s =
{
sizeof(tsdp_header_O_t),
tsdp_header_O_create,
tsdp_header_O_destroy,
tsdp_header_O_cmp
};
const void *tsdp_header_O_def_t = &tsdp_header_O_def_s;

View File

@ -0,0 +1,159 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_P.c
* @brief SDP "p=" header (Phone Number).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_P.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_P;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_P->value);
}
action eob{
}
P = 'p' SP* "=" SP*<: any*>tag %parse_value;
# Entry point
main := P :>CRLF @eob;
}%%
int tsdp_header_P_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_P_t *P = (const tsdp_header_P_t *)header;
if(P->value){
tsk_buffer_append(output, P->value, strlen(P->value));
}
return 0;
}
return -1;
}
tsdp_header_P_t *tsdp_header_P_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_P_t *hdr_P = TSDP_HEADER_P_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"p=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_P);
}
return hdr_P;
}
//========================================================
// P header object definition
//
static void* tsdp_header_P_create(void *self, va_list * app)
{
tsdp_header_P_t *P = self;
if(P)
{
TSDP_HEADER(P)->type = tsdp_htype_P;
TSDP_HEADER(P)->tostring = tsdp_header_P_tostring;
TSDP_HEADER(P)->rank = TSDP_HTYPE_P_RANK;
P->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_P_destroy(void *self)
{
tsdp_header_P_t *P = self;
if(P){
TSK_FREE(P->value);
}
else{
TSK_DEBUG_ERROR("Null P header.");
}
return self;
}
static int tsdp_header_P_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_P_def_s =
{
sizeof(tsdp_header_P_t),
tsdp_header_P_create,
tsdp_header_P_destroy,
tsdp_header_P_cmp
};
const void *tsdp_header_P_def_t = &tsdp_header_P_def_s;

View File

@ -0,0 +1,183 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_C.c
* @brief SDP "r=" header (Repeat Times).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_R.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_R;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_repeat_interval{
TSK_PARSER_SET_STRING(hdr_R->repeat_interval);
}
action parse_typed_time{
if(!hdr_R->typed_time){
TSK_PARSER_SET_STRING(hdr_R->typed_time);
}
else{
TSK_PARSER_ADD_STRING(hdr_R->typed_times);
}
}
action eob{
}
fixed_len_time_unit = "d" | "h" | "m" | "s";
repeat_interval = (DIGIT+ fixed_len_time_unit?) >tag %parse_repeat_interval;
typed_time = (DIGIT+ fixed_len_time_unit?) >tag %parse_typed_time;
R = 'r' SP* "=" SP*<: repeat_interval :>SP typed_time (SP<: typed_time)+;
# Entry point
main := R :>CRLF @eob;
}%%
int tsdp_header_R_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_R_t *R = (const tsdp_header_R_t *)header;
const tsk_list_item_t* item;
// r=7d 1h 0 25h
tsk_buffer_appendEx(output, "%s %s",
R->repeat_interval,
R->typed_time
);
tsk_list_foreach(item, R->typed_times)
{
tsk_string_t* string = item->data;
tsk_buffer_appendEx(output, " %s", TSK_STRING_STR(string));
}
return 0;
}
return -1;
}
tsdp_header_R_t *tsdp_header_R_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_R_t *hdr_R = TSDP_HEADER_R_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"r=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_R);
}
return hdr_R;
}
//========================================================
// E header object definition
//
static void* tsdp_header_R_create(void *self, va_list * app)
{
tsdp_header_R_t *R = self;
if(R)
{
TSDP_HEADER(R)->type = tsdp_htype_R;
TSDP_HEADER(R)->tostring = tsdp_header_R_tostring;
TSDP_HEADER(R)->rank = TSDP_HTYPE_R_RANK;
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_R_destroy(void *self)
{
tsdp_header_R_t *R = self;
if(R){
TSK_FREE(R->repeat_interval);
TSK_FREE(R->typed_time);
TSK_OBJECT_SAFE_FREE(R->typed_times);
}
else{
TSK_DEBUG_ERROR("Null P header.");
}
return self;
}
static int tsdp_header_R_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_R_def_s =
{
sizeof(tsdp_header_R_t),
tsdp_header_R_create,
tsdp_header_R_destroy,
tsdp_header_R_cmp
};
const void *tsdp_header_R_def_t = &tsdp_header_R_def_s;

View File

@ -0,0 +1,157 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_S.c
* @brief SDP "s=" header (Session Name).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_S.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_S;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_S->value);
}
action eob{
}
S = 's' SP* "=" SP*<: any*>tag %parse_value;
# Entry point
main := S :>CRLF @eob;
}%%
int tsdp_header_S_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_S_t *S = (const tsdp_header_S_t *)header;
if(S->value){
tsk_buffer_append(output, S->value, strlen(S->value));
}
return 0;
}
return -1;
}
tsdp_header_S_t *tsdp_header_S_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_S_t *hdr_S = TSDP_HEADER_S_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_OBJECT_SAFE_FREE(hdr_S);
}
return hdr_S;
}
//========================================================
// S header object definition
//
static void* tsdp_header_S_create(void *self, va_list * app)
{
tsdp_header_S_t *S = self;
if(S)
{
TSDP_HEADER(S)->type = tsdp_htype_S;
TSDP_HEADER(S)->tostring = tsdp_header_S_tostring;
TSDP_HEADER(S)->rank = TSDP_HTYPE_S_RANK;
S->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new S header.");
}
return self;
}
static void* tsdp_header_S_destroy(void *self)
{
tsdp_header_S_t *S = self;
if(S){
TSK_FREE(S->value);
}
else{
TSK_DEBUG_ERROR("Null S header.");
}
return self;
}
static int tsdp_header_S_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_S_def_s =
{
sizeof(tsdp_header_S_t),
tsdp_header_S_create,
tsdp_header_S_destroy,
tsdp_header_S_cmp
};
const void *tsdp_header_S_def_t = &tsdp_header_S_def_s;

View File

@ -0,0 +1,199 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_T.c
* @brief SDP "t=" header (Timing).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Uat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_T.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_T;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_T->value);
}
action parse_start_time{
TSK_PARSER_SET_INTEGER_EX(hdr_T->start, uint64_t, atoi64);
}
action parse_stop_time{
TSK_PARSER_SET_INTEGER_EX(hdr_T->stop, uint64_t, atoi64);
}
action parse_repeat_fields{
tsdp_header_R_t* header_R;
if((header_R = tsdp_header_R_parse(tag_start, (p - tag_start)))){
if(!hdr_T->repeat_fields){
hdr_T->repeat_fields = TSK_LIST_CREATE();
}
tsk_list_push_back_data(hdr_T->repeat_fields, (void**)&header_R);
}
}
action eob{
}
start_time = DIGIT+ >tag %parse_start_time;
stop_time = DIGIT+ >tag %parse_stop_time;
repeat_fields = any+ >tag %parse_repeat_fields;
T = 't' SP* "=" SP*<: start_time :>SP stop_time (CRLF <:repeat_fields)?;
# Entry point
main := T :>CRLF @eob;
}%%
int tsdp_header_T_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_T_t *T = (const tsdp_header_T_t *)header;
const tsk_list_item_t *item;
//"t=3034423619 3042462419\r\n"
//"r=7d 1h 0 25h\r\n"
// IMPORTANT: Do not append the last CRLF (because we only print the header value).
tsk_buffer_appendEx(output, "%llu %llu",
T->start,
T->stop
);
tsk_list_foreach(item, T->repeat_fields)
{
if(TSK_LIST_IS_FIRST(T->repeat_fields, item)){
tsk_buffer_append(output, "\r\n", 2);
}
tsk_buffer_appendEx(output, "%c=", tsdp_header_get_nameex(TSDP_HEADER(item->data)));
TSDP_HEADER(item->data)->tostring(TSDP_HEADER(item->data), output);
//tsdp_header_tostring(TSDP_HEADER(item->data), output);
if(!TSK_LIST_IS_LAST(T->repeat_fields, item)){
tsk_buffer_append(output, "\r\n", 2);
}
}
return 0;
}
return -1;
}
tsdp_header_T_t *tsdp_header_T_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_T_t *hdr_T = TSDP_HEADER_T_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"t=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_T);
}
return hdr_T;
}
//========================================================
// T header object definition
//
static void* tsdp_header_T_create(void *self, va_list * app)
{
tsdp_header_T_t *T = self;
if(T)
{
TSDP_HEADER(T)->type = tsdp_htype_T;
TSDP_HEADER(T)->tostring = tsdp_header_T_tostring;
TSDP_HEADER(T)->rank = TSDP_HTYPE_T_RANK;
}
else{
TSK_DEBUG_ERROR("Failed to create new U header.");
}
return self;
}
static void* tsdp_header_T_destroy(void *self)
{
tsdp_header_T_t *T = self;
if(T){
TSK_OBJECT_SAFE_FREE(T->repeat_fields);
}
else{
TSK_DEBUG_ERROR("Null U header.");
}
return self;
}
static int tsdp_header_T_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_T_def_s =
{
sizeof(tsdp_header_T_t),
tsdp_header_T_create,
tsdp_header_T_destroy,
tsdp_header_T_cmp
};
const void *tsdp_header_T_def_t = &tsdp_header_T_def_s;

View File

@ -0,0 +1,158 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_U.c
* @brief SDP "u=" header (URI).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Uat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_U.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_U;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_value{
TSK_PARSER_SET_STRING(hdr_U->value);
}
action eob{
}
U = 'u' SP* "=" SP*<: any*>tag %parse_value;
# Entry point
main := U :>CRLF @eob;
}%%
int tsdp_header_U_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_U_t *U = (const tsdp_header_U_t *)header;
if(U->value){
tsk_buffer_append(output, U->value, strlen(U->value));
}
return 0;
}
return -1;
}
tsdp_header_U_t *tsdp_header_U_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_U_t *hdr_U = TSDP_HEADER_U_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"u=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_U);
}
return hdr_U;
}
//========================================================
// U header object definition
//
static void* tsdp_header_U_create(void *self, va_list * app)
{
tsdp_header_U_t *U = self;
if(U)
{
TSDP_HEADER(U)->type = tsdp_htype_U;
TSDP_HEADER(U)->tostring = tsdp_header_U_tostring;
TSDP_HEADER(U)->rank = TSDP_HTYPE_U_RANK;
U->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new U header.");
}
return self;
}
static void* tsdp_header_U_destroy(void *self)
{
tsdp_header_U_t *U = self;
if(U){
TSK_FREE(U->value);
}
else{
TSK_DEBUG_ERROR("Null U header.");
}
return self;
}
static int tsdp_header_U_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_U_def_s =
{
sizeof(tsdp_header_U_t),
tsdp_header_U_create,
tsdp_header_U_destroy,
tsdp_header_U_cmp
};
const void *tsdp_header_U_def_t = &tsdp_header_U_def_s;

View File

@ -0,0 +1,157 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_V.c
* @brief SDP "v=" header (Protocol Version).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_V.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_V;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action parse_version{
TSK_PARSER_SET_INT(hdr_V->version);
}
action eob{
}
V = 'v' SP* "=" SP*<: DIGIT+>tag %parse_version;
# Entry point
main := V :>CRLF @eob;
}%%
int tsdp_header_V_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_V_t *V = (const tsdp_header_V_t *)header;
if(V->version >=0){
tsk_buffer_appendEx(output, "%d", V->version);
}
return 0;
}
return -1;
}
tsdp_header_V_t *tsdp_header_V_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_V_t *hdr_V = TSDP_HEADER_V_CREATE_NULL();
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"v=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_V);
}
return hdr_V;
}
//========================================================
// V header object definition
//
static void* tsdp_header_V_create(void *self, va_list * app)
{
tsdp_header_V_t *V = self;
if(V)
{
TSDP_HEADER(V)->type = tsdp_htype_V;
TSDP_HEADER(V)->tostring = tsdp_header_V_tostring;
TSDP_HEADER(V)->rank = TSDP_HTYPE_V_RANK;
V->version = va_arg(*app, int32_t);
}
else{
TSK_DEBUG_ERROR("Failed to create new V header.");
}
return self;
}
static void* tsdp_header_V_destroy(void *self)
{
tsdp_header_V_t *V = self;
if(V){
}
else{
TSK_DEBUG_ERROR("Null V header.");
}
return self;
}
static int tsdp_header_V_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_V_def_s =
{
sizeof(tsdp_header_V_t),
tsdp_header_V_create,
tsdp_header_V_destroy,
tsdp_header_V_cmp
};
const void *tsdp_header_V_def_t = &tsdp_header_V_def_s;

View File

@ -0,0 +1,262 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_Z.c
* @brief SDP "z=" header (Time Zones).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_Z.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
%%{
machine tsdp_machine_parser_header_Z;
# Includes
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
action create_zone{
if(!zone){
zone = TSDP_ZONE_CREATE_NULL();
}
}
action add_zone{
if(zone){
tsk_list_push_back_data(hdr_Z->zones,(void**)&zone);
}
}
action parse_time{
if(zone){
TSK_PARSER_SET_INTEGER_EX(zone->time, uint64_t, atoi64);
}
}
action parse_typed_time{
if(zone){
TSK_PARSER_SET_STRING(zone->typed_time);
}
}
action shifted{
if(zone){
zone->shifted_back = 1;
}
}
action eob{
}
fixed_len_time_unit = "d" | "h" | "m" | "s";
time = DIGIT+ >tag %parse_time;
typed_time = (DIGIT+ fixed_len_time_unit?) >tag %parse_typed_time;
Z = 'z' SP* "=" (time SP ("-"%shifted)? typed_time) >create_zone %add_zone
(SP time SP ("-"%shifted)? typed_time)* >create_zone %add_zone;
# Entry point
main := Z :>CRLF @eob;
}%%
int tsdp_header_Z_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_Z_t *Z = (const tsdp_header_Z_t *)header;
const tsk_list_item_t *item;
const tsdp_zone_t* zone;
tsk_list_foreach(item, Z->zones)
{
zone = item->data;
// time SP ["-"] typed-time
tsk_buffer_appendEx(output, "%s%llu %s%s",
TSK_LIST_IS_FIRST(Z->zones, item) ? "" : " ",
zone->time,
zone->shifted_back ? "-" : "",
zone->typed_time
);
}
}
return -1;
}
tsdp_header_Z_t *tsdp_header_Z_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_Z_t *hdr_Z = TSDP_HEADER_Z_CREATE_NULL();
tsdp_zone_t* zone = TSDP_NULL;
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if(zone){
TSK_OBJECT_SAFE_FREE(zone);
}
if( cs < %%{ write first_final; }%% ){
TSK_DEBUG_ERROR("Failed to parse \"b=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_Z);
}
return hdr_Z;
}
//========================================================
// Z header object definition
//
static void* tsdp_header_Z_create(void *self, va_list * app)
{
tsdp_header_Z_t *Z = self;
if(Z)
{
TSDP_HEADER(Z)->type = tsdp_htype_Z;
TSDP_HEADER(Z)->tostring = tsdp_header_Z_tostring;
TSDP_HEADER(Z)->rank = TSDP_HTYPE_Z_RANK;
if((Z->zones = TSK_LIST_CREATE())){
uint64_t time = va_arg(*app, uint64_t);
unsigned shifted_back = va_arg(*app, unsigned);
const char* typed_time = va_arg(*app, const char*);
if(typed_time){
tsdp_zone_t *zone;
if((zone = TSDP_ZONE_CREATE(time, shifted_back, typed_time))){
tsk_list_push_back_data(Z->zones,(void**)&zone);
}
}
}
}
else{
TSK_DEBUG_ERROR("Failed to create new Z header.");
}
return self;
}
static void* tsdp_header_Z_destroy(void *self)
{
tsdp_header_Z_t *Z = self;
if(Z){
TSK_OBJECT_SAFE_FREE(Z->zones);
}
else{
TSK_DEBUG_ERROR("Null Z header.");
}
return self;
}
static int tsdp_header_Z_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_Z_def_s =
{
sizeof(tsdp_header_Z_t),
tsdp_header_Z_create,
tsdp_header_Z_destroy,
tsdp_header_Z_cmp
};
const void *tsdp_header_Z_def_t = &tsdp_header_Z_def_s;
//========================================================
// Zone object definition
//
static void* tsdp_zone_create(void *self, va_list * app)
{
tsdp_zone_t *zone = self;
if(zone)
{
zone->time = va_arg(*app, uint64_t);
zone->shifted_back = va_arg(*app, unsigned);
zone->typed_time = tsk_strdup( va_arg(*app, const char*) );
}
else{
TSK_DEBUG_ERROR("Failed to create new zone object.");
}
return self;
}
static void* tsdp_zone_destroy(void *self)
{
tsdp_zone_t *zone = self;
if(zone){
TSK_FREE(zone->typed_time);
}
else{
TSK_DEBUG_ERROR("Null zone object.");
}
return self;
}
static const tsk_object_def_t tsdp_zone_def_s =
{
sizeof(tsdp_zone_t),
tsdp_zone_create,
tsdp_zone_destroy,
0
};
const void *tsdp_zone_def_t = &tsdp_zone_def_s;

View File

@ -0,0 +1,268 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_machine_message.rl
* @brief Ragel file.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/parsers/tsdp_parser_message.h"
#include "tinySDP/headers/tsdp_header_B.h"
#include "tinySDP/headers/tsdp_header_C.h"
#include "tinySDP/headers/tsdp_header_Dummy.h"
#include "tinySDP/headers/tsdp_header_E.h"
#include "tinySDP/headers/tsdp_header_I.h"
#include "tinySDP/headers/tsdp_header_K.h"
#include "tinySDP/headers/tsdp_header_O.h"
#include "tinySDP/headers/tsdp_header_P.h"
#include "tinySDP/headers/tsdp_header_R.h"
#include "tinySDP/headers/tsdp_header_S.h"
#include "tinySDP/headers/tsdp_header_T.h"
#include "tinySDP/headers/tsdp_header_U.h"
#include "tinySDP/headers/tsdp_header_V.h"
#include "tinySDP/headers/tsdp_header_Z.h"
#include "tsk_debug.h"
%%{
machine tsdp_machine_message;
###########################################
# Includes
###########################################
include tsdp_machine_utils "./tsdp_machine_utils.rl";
action tag{
tag_start = p;
}
###########################################
# Actions
###########################################
action parse_header_A{
TSK_DEBUG_INFO("Header A");
}
action parse_header_B{
if((header = (tsdp_header_t*)tsdp_header_B_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header B");
}
action parse_header_C{
if((header = (tsdp_header_t*)tsdp_header_C_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header C");
}
action parse_header_Dummy{
if((header = (tsdp_header_t*)tsdp_header_Dummy_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header Dummy");
}
action parse_header_E{
if((header = (tsdp_header_t*)tsdp_header_E_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header E");
}
action parse_header_I{
if((header = (tsdp_header_t*)tsdp_header_I_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header I");
}
action parse_header_K{
if((header = (tsdp_header_t*)tsdp_header_K_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header K");
}
action parse_header_M{
TSK_DEBUG_INFO("Header M");
}
action parse_header_O{
if((header = (tsdp_header_t*)tsdp_header_O_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header O");
}
action parse_header_P{
if((header = (tsdp_header_t*)tsdp_header_P_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header P");
}
action parse_header_R{
if((header = (tsdp_header_t*)tsdp_header_R_parse(tag_start, (p - tag_start)))){
if(hdr_T){
if(!hdr_T->repeat_fields){
hdr_T->repeat_fields = TSK_LIST_CREATE();
}
tsk_list_push_back_data(hdr_T->repeat_fields, (void**)&header);
}
else{
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
}
TSK_DEBUG_INFO("Header R");
}
action parse_header_S{
if((header = (tsdp_header_t*)tsdp_header_S_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header S");
}
action parse_header_T{
if((hdr_T = tsdp_header_T_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, TSDP_HEADER(hdr_T));
hdr_T = tsk_object_unref(hdr_T);
}
TSK_DEBUG_INFO("Header T");
}
action parse_header_U{
if((header = (tsdp_header_t*)tsdp_header_U_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header U");
}
action parse_header_V{
if((header = (tsdp_header_t*)tsdp_header_V_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header V");
}
action parse_header_Z{
if((header = (tsdp_header_t*)tsdp_header_Z_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header Z");
}
###########################################
# Headers
###########################################
A = "a"i SP* "=" SP*<: any* :>CRLF %parse_header_A;
B = "b"i SP* "=" SP*<: any* :>CRLF %parse_header_B;
C = "c"i SP* "=" SP*<: any* :>CRLF %parse_header_C;
E = "e"i SP* "=" SP*<: any* :>CRLF %parse_header_E;
I = "i"i SP* "=" SP*<: any* :>CRLF %parse_header_I;
K = "k"i SP* "=" SP*<: any* :>CRLF %parse_header_K;
M = "m"i SP* "=" SP*<: any* :>CRLF %parse_header_M;
O = "o"i SP* "=" SP*<: any* :>CRLF %parse_header_O;
P = "p"i SP* "=" SP*<: any* :>CRLF %parse_header_P;
R = "r"i SP* "=" SP*<: any* :>CRLF %parse_header_R;
S = "s"i SP* "=" SP*<: any* :>CRLF %parse_header_S;
T = "t"i SP* "=" SP*<: any* :>CRLF %parse_header_T;
U = "u"i SP* "=" SP*<: any* :>CRLF %parse_header_U;
V = "v"i SP* "=" SP*<: any* :>CRLF %parse_header_V;
Z = "z"i SP* "=" SP*<: any* :>CRLF %parse_header_Z;
Dummy = alpha SP* "=" SP*<: any* :>CRLF %parse_header_Dummy;
Header = (A | B | C | E | I | K | M | O | P | R | S | T | U | V | Z)>tag @1 | (Dummy>tag) @0;
###########################################
# Message
###########################################
SDP_message = Header*;
###########################################
# Entry Point
###########################################
main := SDP_message;
}%%
/* Ragel data */
%% write data;
tsdp_message_t* tsdp_message_parse(const void *input, size_t size)
{
tsdp_message_t* sdp_msg = TSDP_NULL;
const char* tag_start = TSDP_NULL;
tsdp_header_t *header = TSDP_NULL;
tsdp_header_T_t *hdr_T = TSDP_NULL;
/* Ragel variables */
int cs = 0;
const char* p = input;
const char* pe = p + size;
const char* eof = TSDP_NULL;
if(!input || !size){
TSK_DEBUG_ERROR("Null or empty buffer.");
goto bail;
}
if(!(sdp_msg = TSDP_MESSAGE_CREATE())){
goto bail;
}
/* Ragel init */
%% write init;
/* Ragel execute */
%% write exec;
/* Check result */
if( cs < %%{ write first_final; }%% )
{
TSK_DEBUG_ERROR("Failed to parse SDP message.");
TSK_OBJECT_SAFE_FREE(sdp_msg);
goto bail;
}
bail:
return sdp_msg;
}

View File

@ -0,0 +1,108 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header.c
* @brief Defines a SDP header/line (<type>=<value>).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header.h"
#include "tinySDP/headers/tsdp_header_Dummy.h"
int tsdp_header_rank_cmp(const tsdp_header_t* hdr1, const tsdp_header_t* hdr2)
{
if(hdr1 && hdr2){
return (hdr1->rank - hdr2->rank);
}
else{
return -1;
}
}
/** Gets the name of the SDP header with a type equal to @a type.
* @param type The @a type of the header for which to retrieve the name.
*
* @return The name of the header.
**/
char tsdp_header_get_name(tsdp_header_type_t type)
{
switch(type)
{
case tsdp_htype_A: return 'a';
case tsdp_htype_B: return 'b';
case tsdp_htype_C: return 'c';
case tsdp_htype_E: return 'e';
case tsdp_htype_I: return 'i';
case tsdp_htype_K: return 'k';
case tsdp_htype_M: return 'm';
case tsdp_htype_O: return 'o';
case tsdp_htype_P: return 'p';
case tsdp_htype_R: return 'r';
case tsdp_htype_S: return 's';
case tsdp_htype_T: return 't';
case tsdp_htype_U: return 'u';
case tsdp_htype_V: return 'v';
case tsdp_htype_Z: return 'z';
default: return '*';
}
}
char tsdp_header_get_nameex(const tsdp_header_t *self)
{
if(self){
if(self->type == tsdp_htype_Dummy){
return ((tsdp_header_Dummy_t*)(self))->name;
}
else{
return tsdp_header_get_name(self->type);
}
}
return '*';
}
int tsdp_header_tostring(const tsdp_header_t *self, tsk_buffer_t *output)
{
static char name;
int ret = -1;
if(!self || !output){
return -1;
}
/* Name */
name = tsdp_header_get_nameex(self);
tsk_buffer_appendEx(output, "%c=", name);
/* Value */
if((ret = self->tostring(self, output))){
// Abort?
}
/* CRLF*/
ret = tsk_buffer_append(output, "\r\n", 2);
return ret;
}

View File

@ -0,0 +1,2 @@
/* #line 1 "tsdp_parser_header_A.rl" */

View File

@ -0,0 +1,328 @@
/* #line 1 "tsdp_parser_header_B.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_B.c
* @brief SDP "b=" header (Bandwidth).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_B.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 71 "tsdp_parser_header_B.rl" */
int tsdp_header_B_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_B_t *B = (const tsdp_header_B_t *)header;
return tsk_buffer_appendEx(output, "%s:%u",
B->bwtype,
B->bandwidth
);
}
return -1;
}
tsdp_header_B_t *tsdp_header_B_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_B_t *hdr_B = TSDP_HEADER_B_CREATE_NULL();
const char *tag_start;
/* #line 75 "../src/headers/tsdp_header_B.c" */
static const char _tsdp_machine_parser_header_B_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3
};
static const char _tsdp_machine_parser_header_B_key_offsets[] = {
0, 0, 1, 3, 18, 35, 38, 43,
44, 46, 50, 53, 54
};
static const char _tsdp_machine_parser_header_B_trans_keys[] = {
98, 32, 61, 32, 33, 37, 39, 126,
42, 43, 45, 46, 48, 57, 65, 90,
95, 122, 9, 32, 33, 37, 39, 58,
126, 42, 43, 45, 46, 48, 57, 65,
90, 95, 122, 9, 32, 58, 9, 13,
32, 48, 57, 10, 9, 32, 9, 32,
48, 57, 13, 48, 57, 10, 0
};
static const char _tsdp_machine_parser_header_B_single_lengths[] = {
0, 1, 2, 5, 7, 3, 3, 1,
2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_B_range_lengths[] = {
0, 0, 0, 5, 5, 0, 1, 0,
0, 1, 1, 0, 0
};
static const char _tsdp_machine_parser_header_B_index_offsets[] = {
0, 0, 2, 5, 16, 29, 33, 38,
40, 43, 47, 50, 52
};
static const char _tsdp_machine_parser_header_B_indicies[] = {
0, 1, 0, 2, 1, 2, 3, 3,
3, 3, 3, 3, 3, 3, 3, 1,
4, 4, 5, 5, 5, 6, 5, 5,
5, 5, 5, 5, 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 _tsdp_machine_parser_header_B_trans_targs[] = {
2, 0, 3, 4, 5, 4, 6, 5,
6, 7, 10, 8, 9, 11, 10, 12
};
static const char _tsdp_machine_parser_header_B_trans_actions[] = {
0, 0, 0, 1, 3, 0, 3, 0,
0, 0, 1, 0, 0, 5, 0, 7
};
static const int tsdp_machine_parser_header_B_start = 1;
static const int tsdp_machine_parser_header_B_first_final = 12;
static const int tsdp_machine_parser_header_B_error = 0;
static const int tsdp_machine_parser_header_B_en_main = 1;
/* #line 99 "tsdp_parser_header_B.rl" */
/* #line 140 "../src/headers/tsdp_header_B.c" */
{
cs = tsdp_machine_parser_header_B_start;
}
/* #line 100 "tsdp_parser_header_B.rl" */
/* #line 147 "../src/headers/tsdp_header_B.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 = _tsdp_machine_parser_header_B_trans_keys + _tsdp_machine_parser_header_B_key_offsets[cs];
_trans = _tsdp_machine_parser_header_B_index_offsets[cs];
_klen = _tsdp_machine_parser_header_B_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 = _tsdp_machine_parser_header_B_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 = _tsdp_machine_parser_header_B_indicies[_trans];
cs = _tsdp_machine_parser_header_B_trans_targs[_trans];
if ( _tsdp_machine_parser_header_B_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_B_actions + _tsdp_machine_parser_header_B_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_B.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_B.rl" */
{
TSK_PARSER_SET_STRING(hdr_B->bwtype);
}
break;
case 2:
/* #line 56 "tsdp_parser_header_B.rl" */
{
TSK_PARSER_SET_UINT(hdr_B->bandwidth);
}
break;
case 3:
/* #line 60 "tsdp_parser_header_B.rl" */
{
}
break;
/* #line 244 "../src/headers/tsdp_header_B.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 101 "tsdp_parser_header_B.rl" */
if( cs <
/* #line 260 "../src/headers/tsdp_header_B.c" */
12
/* #line 102 "tsdp_parser_header_B.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"b=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_B);
}
return hdr_B;
}
//========================================================
// B header object definition
//
static void* tsdp_header_B_create(void *self, va_list * app)
{
tsdp_header_B_t *B = self;
if(B)
{
TSDP_HEADER(B)->type = tsdp_htype_B;
TSDP_HEADER(B)->tostring = tsdp_header_B_tostring;
TSDP_HEADER(B)->rank = TSDP_HTYPE_B_RANK;
B->bwtype = tsk_strdup(va_arg(*app, const char*));
B->bandwidth = va_arg(*app, uint32_t);
}
else{
TSK_DEBUG_ERROR("Failed to create new B header.");
}
return self;
}
static void* tsdp_header_B_destroy(void *self)
{
tsdp_header_B_t *B = self;
if(B){
TSK_FREE(B->bwtype);
}
else{
TSK_DEBUG_ERROR("Null B header.");
}
return self;
}
static int tsdp_header_B_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_B_def_s =
{
sizeof(tsdp_header_B_t),
tsdp_header_B_create,
tsdp_header_B_destroy,
tsdp_header_B_cmp
};
const void *tsdp_header_B_def_t = &tsdp_header_B_def_s;

View File

@ -0,0 +1,327 @@
/* #line 1 "tsdp_parser_header_C.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_C.c
* @brief "c=" header (Connection Data).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_C.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 74 "tsdp_parser_header_C.rl" */
int tsdp_header_C_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_C_t *C = (const tsdp_header_C_t *)header;
return tsk_buffer_appendEx(output, "%s %s %s",
C->nettype,
C->addrtype,
C->addr
);
return 0;
}
return -1;
}
tsdp_header_C_t *tsdp_header_C_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_C_t *hdr_C = TSDP_HEADER_C_CREATE_NULL();
const char *tag_start;
/* #line 78 "../src/headers/tsdp_header_C.c" */
static const char _tsdp_machine_parser_header_C_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3, 1, 4, 2, 0, 2, 2, 0,
3
};
static const char _tsdp_machine_parser_header_C_key_offsets[] = {
0, 0, 1, 3, 4, 5, 6, 7,
8, 9, 10
};
static const char _tsdp_machine_parser_header_C_trans_keys[] = {
99, 32, 61, 32, 32, 32, 32, 13,
13, 10, 0
};
static const char _tsdp_machine_parser_header_C_single_lengths[] = {
0, 1, 2, 1, 1, 1, 1, 1,
1, 1, 0
};
static const char _tsdp_machine_parser_header_C_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0
};
static const char _tsdp_machine_parser_header_C_index_offsets[] = {
0, 0, 2, 5, 7, 9, 11, 13,
15, 17, 19
};
static const char _tsdp_machine_parser_header_C_trans_targs[] = {
2, 0, 2, 3, 0, 3, 4, 5,
4, 7, 6, 7, 6, 9, 8, 9,
8, 10, 0, 0, 0
};
static const char _tsdp_machine_parser_header_C_trans_actions[] = {
0, 0, 0, 0, 0, 0, 1, 3,
0, 11, 1, 5, 0, 14, 1, 7,
0, 9, 0, 0, 0
};
static const int tsdp_machine_parser_header_C_start = 1;
static const int tsdp_machine_parser_header_C_first_final = 10;
static const int tsdp_machine_parser_header_C_error = 0;
static const int tsdp_machine_parser_header_C_en_main = 1;
/* #line 105 "tsdp_parser_header_C.rl" */
/* #line 131 "../src/headers/tsdp_header_C.c" */
{
cs = tsdp_machine_parser_header_C_start;
}
/* #line 106 "tsdp_parser_header_C.rl" */
/* #line 138 "../src/headers/tsdp_header_C.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 = _tsdp_machine_parser_header_C_trans_keys + _tsdp_machine_parser_header_C_key_offsets[cs];
_trans = _tsdp_machine_parser_header_C_index_offsets[cs];
_klen = _tsdp_machine_parser_header_C_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 = _tsdp_machine_parser_header_C_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:
cs = _tsdp_machine_parser_header_C_trans_targs[_trans];
if ( _tsdp_machine_parser_header_C_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_C_actions + _tsdp_machine_parser_header_C_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_C.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_C.rl" */
{
TSK_PARSER_SET_STRING(hdr_C->nettype);
}
break;
case 2:
/* #line 56 "tsdp_parser_header_C.rl" */
{
TSK_PARSER_SET_STRING(hdr_C->addrtype);
}
break;
case 3:
/* #line 60 "tsdp_parser_header_C.rl" */
{
TSK_PARSER_SET_STRING(hdr_C->addr);
}
break;
case 4:
/* #line 64 "tsdp_parser_header_C.rl" */
{
}
break;
/* #line 240 "../src/headers/tsdp_header_C.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 107 "tsdp_parser_header_C.rl" */
if( cs <
/* #line 256 "../src/headers/tsdp_header_C.c" */
10
/* #line 108 "tsdp_parser_header_C.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"c=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_C);
}
return hdr_C;
}
//========================================================
// E header object definition
//
static void* tsdp_header_C_create(void *self, va_list * app)
{
tsdp_header_C_t *C = self;
if(C)
{
TSDP_HEADER(C)->type = tsdp_htype_C;
TSDP_HEADER(C)->tostring = tsdp_header_C_tostring;
TSDP_HEADER(C)->rank = TSDP_HTYPE_C_RANK;
C->nettype = tsk_strdup(va_arg(*app, const char*));
C->addrtype = tsk_strdup(va_arg(*app, const char*));
C->addr = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_C_destroy(void *self)
{
tsdp_header_C_t *C = self;
if(C){
TSK_FREE(C->nettype);
TSK_FREE(C->addrtype);
TSK_FREE(C->addr);
}
else{
TSK_DEBUG_ERROR("Null P header.");
}
return self;
}
static int tsdp_header_C_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_C_def_s =
{
sizeof(tsdp_header_C_t),
tsdp_header_C_create,
tsdp_header_C_destroy,
tsdp_header_C_cmp
};
const void *tsdp_header_C_def_t = &tsdp_header_C_def_s;

View File

@ -0,0 +1,307 @@
/* #line 1 "tsdp_parser_header_Dummy.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_Dummy.c
* @brief SDP DUmmy header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_Dummy.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 67 "tsdp_parser_header_Dummy.rl" */
int tsdp_header_Dummy_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_Dummy_t *Dummy = (const tsdp_header_Dummy_t *)header;
if(Dummy->value){
tsk_buffer_append(output, Dummy->value, strlen(Dummy->value));
}
return 0;
}
return -1;
}
tsdp_header_Dummy_t *tsdp_header_Dummy_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_Dummy_t *hdr_Dummy = TSDP_HEADER_DUMMY_CREATE_NULL();
const char *tag_start;
/* #line 73 "../src/headers/tsdp_header_Dummy.c" */
static const char _tsdp_machine_parser_header_Dummy_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3, 2, 0, 2
};
static const char _tsdp_machine_parser_header_Dummy_key_offsets[] = {
0, 0, 4, 6, 8, 10, 11, 12
};
static const char _tsdp_machine_parser_header_Dummy_trans_keys[] = {
65, 90, 97, 122, 32, 61, 32, 61,
13, 32, 13, 10, 0
};
static const char _tsdp_machine_parser_header_Dummy_single_lengths[] = {
0, 0, 2, 2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_Dummy_range_lengths[] = {
0, 2, 0, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_Dummy_index_offsets[] = {
0, 0, 3, 6, 9, 12, 14, 16
};
static const char _tsdp_machine_parser_header_Dummy_trans_targs[] = {
2, 2, 0, 3, 4, 0, 3, 4,
0, 6, 4, 5, 6, 5, 7, 0,
0, 0
};
static const char _tsdp_machine_parser_header_Dummy_trans_actions[] = {
1, 1, 0, 3, 3, 0, 0, 0,
0, 9, 0, 1, 5, 0, 7, 0,
0, 0
};
static const int tsdp_machine_parser_header_Dummy_start = 1;
static const int tsdp_machine_parser_header_Dummy_first_final = 7;
static const int tsdp_machine_parser_header_Dummy_error = 0;
static const int tsdp_machine_parser_header_Dummy_en_main = 1;
/* #line 94 "tsdp_parser_header_Dummy.rl" */
/* #line 121 "../src/headers/tsdp_header_Dummy.c" */
{
cs = tsdp_machine_parser_header_Dummy_start;
}
/* #line 95 "tsdp_parser_header_Dummy.rl" */
/* #line 128 "../src/headers/tsdp_header_Dummy.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 = _tsdp_machine_parser_header_Dummy_trans_keys + _tsdp_machine_parser_header_Dummy_key_offsets[cs];
_trans = _tsdp_machine_parser_header_Dummy_index_offsets[cs];
_klen = _tsdp_machine_parser_header_Dummy_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 = _tsdp_machine_parser_header_Dummy_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:
cs = _tsdp_machine_parser_header_Dummy_trans_targs[_trans];
if ( _tsdp_machine_parser_header_Dummy_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_Dummy_actions + _tsdp_machine_parser_header_Dummy_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 47 "tsdp_parser_header_Dummy.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 51 "tsdp_parser_header_Dummy.rl" */
{
hdr_Dummy->name = *tag_start;
}
break;
case 2:
/* #line 55 "tsdp_parser_header_Dummy.rl" */
{
TSK_PARSER_SET_STRING(hdr_Dummy->value);
}
break;
case 3:
/* #line 59 "tsdp_parser_header_Dummy.rl" */
{
}
break;
/* #line 224 "../src/headers/tsdp_header_Dummy.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 96 "tsdp_parser_header_Dummy.rl" */
if( cs <
/* #line 240 "../src/headers/tsdp_header_Dummy.c" */
7
/* #line 97 "tsdp_parser_header_Dummy.rl" */
){
TSK_OBJECT_SAFE_FREE(hdr_Dummy);
}
return hdr_Dummy;
}
//========================================================
// Dummy header object definition
//
static void* tsdp_header_Dummy_create(void *self, va_list * app)
{
tsdp_header_Dummy_t *Dummy = self;
if(Dummy)
{
TSDP_HEADER(Dummy)->type = tsdp_htype_Dummy;
TSDP_HEADER(Dummy)->tostring = tsdp_header_Dummy_tostring;
TSDP_HEADER(Dummy)->rank = TSDP_HTYPE_DUMMY_RANK;
Dummy->name = va_arg(*app, const char);
Dummy->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new Dummy header.");
}
return self;
}
static void* tsdp_header_Dummy_destroy(void *self)
{
tsdp_header_Dummy_t *Dummy = self;
if(Dummy){
TSK_FREE(Dummy->value);
}
else{
TSK_DEBUG_ERROR("Null Dummy header.");
}
return self;
}
static int tsdp_header_Dummy_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_Dummy_def_s =
{
sizeof(tsdp_header_Dummy_t),
tsdp_header_Dummy_create,
tsdp_header_Dummy_destroy,
tsdp_header_Dummy_cmp
};
const void *tsdp_header_Dummy_def_t = &tsdp_header_Dummy_def_s;

View File

@ -0,0 +1,299 @@
/* #line 1 "tsdp_parser_header_E.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_I.c
* @brief SDP "i=" header (Session Information).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_E.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 64 "tsdp_parser_header_E.rl" */
int tsdp_header_E_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_E_t *E = (const tsdp_header_E_t *)header;
if(E->value){
tsk_buffer_append(output, E->value, strlen(E->value));
}
return 0;
}
return -1;
}
tsdp_header_E_t *tsdp_header_E_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_E_t *hdr_E = TSDP_HEADER_E_CREATE_NULL();
const char *tag_start;
/* #line 74 "../src/headers/tsdp_header_E.c" */
static const char _tsdp_machine_parser_header_E_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsdp_machine_parser_header_E_key_offsets[] = {
0, 0, 1, 3, 5, 6, 7
};
static const char _tsdp_machine_parser_header_E_trans_keys[] = {
101, 32, 61, 13, 32, 13, 10, 0
};
static const char _tsdp_machine_parser_header_E_single_lengths[] = {
0, 1, 2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_E_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_E_index_offsets[] = {
0, 0, 2, 5, 8, 10, 12
};
static const char _tsdp_machine_parser_header_E_trans_targs[] = {
2, 0, 2, 3, 0, 5, 3, 4,
5, 4, 6, 0, 0, 0
};
static const char _tsdp_machine_parser_header_E_trans_actions[] = {
0, 0, 0, 0, 0, 7, 0, 1,
3, 0, 5, 0, 0, 0
};
static const int tsdp_machine_parser_header_E_start = 1;
static const int tsdp_machine_parser_header_E_first_final = 6;
static const int tsdp_machine_parser_header_E_error = 0;
static const int tsdp_machine_parser_header_E_en_main = 1;
/* #line 91 "tsdp_parser_header_E.rl" */
/* #line 119 "../src/headers/tsdp_header_E.c" */
{
cs = tsdp_machine_parser_header_E_start;
}
/* #line 92 "tsdp_parser_header_E.rl" */
/* #line 126 "../src/headers/tsdp_header_E.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 = _tsdp_machine_parser_header_E_trans_keys + _tsdp_machine_parser_header_E_key_offsets[cs];
_trans = _tsdp_machine_parser_header_E_index_offsets[cs];
_klen = _tsdp_machine_parser_header_E_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 = _tsdp_machine_parser_header_E_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:
cs = _tsdp_machine_parser_header_E_trans_targs[_trans];
if ( _tsdp_machine_parser_header_E_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_E_actions + _tsdp_machine_parser_header_E_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_E.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_E.rl" */
{
TSK_PARSER_SET_STRING(hdr_E->value);
}
break;
case 2:
/* #line 56 "tsdp_parser_header_E.rl" */
{
}
break;
/* #line 216 "../src/headers/tsdp_header_E.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 93 "tsdp_parser_header_E.rl" */
if( cs <
/* #line 232 "../src/headers/tsdp_header_E.c" */
6
/* #line 94 "tsdp_parser_header_E.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"e=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_E);
}
return hdr_E;
}
//========================================================
// E header object definition
//
static void* tsdp_header_E_create(void *self, va_list * app)
{
tsdp_header_E_t *E = self;
if(E)
{
TSDP_HEADER(E)->type = tsdp_htype_E;
TSDP_HEADER(E)->tostring = tsdp_header_E_tostring;
TSDP_HEADER(E)->rank = TSDP_HTYPE_E_RANK;
E->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_E_destroy(void *self)
{
tsdp_header_E_t *E = self;
if(E){
TSK_FREE(E->value);
}
else{
TSK_DEBUG_ERROR("Null E header.");
}
return self;
}
static int tsdp_header_E_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_E_def_s =
{
sizeof(tsdp_header_E_t),
tsdp_header_E_create,
tsdp_header_E_destroy,
tsdp_header_E_cmp
};
const void *tsdp_header_E_def_t = &tsdp_header_E_def_s;

View File

@ -0,0 +1,299 @@
/* #line 1 "tsdp_parser_header_I.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_I.c
* @brief SDP "i=" header (Session Information).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_I.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 64 "tsdp_parser_header_I.rl" */
int tsdp_header_I_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_I_t *I = (const tsdp_header_I_t *)header;
if(I->value){
tsk_buffer_append(output, I->value, strlen(I->value));
}
return 0;
}
return -1;
}
tsdp_header_I_t *tsdp_header_I_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_I_t *hdr_I = TSDP_HEADER_I_CREATE_NULL();
const char *tag_start;
/* #line 74 "../src/headers/tsdp_header_I.c" */
static const char _tsdp_machine_parser_header_I_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsdp_machine_parser_header_I_key_offsets[] = {
0, 0, 1, 3, 5, 6, 7
};
static const char _tsdp_machine_parser_header_I_trans_keys[] = {
105, 32, 61, 13, 32, 13, 10, 0
};
static const char _tsdp_machine_parser_header_I_single_lengths[] = {
0, 1, 2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_I_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_I_index_offsets[] = {
0, 0, 2, 5, 8, 10, 12
};
static const char _tsdp_machine_parser_header_I_trans_targs[] = {
2, 0, 2, 3, 0, 5, 3, 4,
5, 4, 6, 0, 0, 0
};
static const char _tsdp_machine_parser_header_I_trans_actions[] = {
0, 0, 0, 0, 0, 7, 0, 1,
3, 0, 5, 0, 0, 0
};
static const int tsdp_machine_parser_header_I_start = 1;
static const int tsdp_machine_parser_header_I_first_final = 6;
static const int tsdp_machine_parser_header_I_error = 0;
static const int tsdp_machine_parser_header_I_en_main = 1;
/* #line 91 "tsdp_parser_header_I.rl" */
/* #line 119 "../src/headers/tsdp_header_I.c" */
{
cs = tsdp_machine_parser_header_I_start;
}
/* #line 92 "tsdp_parser_header_I.rl" */
/* #line 126 "../src/headers/tsdp_header_I.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 = _tsdp_machine_parser_header_I_trans_keys + _tsdp_machine_parser_header_I_key_offsets[cs];
_trans = _tsdp_machine_parser_header_I_index_offsets[cs];
_klen = _tsdp_machine_parser_header_I_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 = _tsdp_machine_parser_header_I_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:
cs = _tsdp_machine_parser_header_I_trans_targs[_trans];
if ( _tsdp_machine_parser_header_I_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_I_actions + _tsdp_machine_parser_header_I_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_I.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_I.rl" */
{
TSK_PARSER_SET_STRING(hdr_I->value);
}
break;
case 2:
/* #line 56 "tsdp_parser_header_I.rl" */
{
}
break;
/* #line 216 "../src/headers/tsdp_header_I.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 93 "tsdp_parser_header_I.rl" */
if( cs <
/* #line 232 "../src/headers/tsdp_header_I.c" */
6
/* #line 94 "tsdp_parser_header_I.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"i=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_I);
}
return hdr_I;
}
//========================================================
// I header object definition
//
static void* tsdp_header_I_create(void *self, va_list * app)
{
tsdp_header_I_t *I = self;
if(I)
{
TSDP_HEADER(I)->type = tsdp_htype_I;
TSDP_HEADER(I)->tostring = tsdp_header_I_tostring;
TSDP_HEADER(I)->rank = TSDP_HTYPE_I_RANK;
I->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new I header.");
}
return self;
}
static void* tsdp_header_I_destroy(void *self)
{
tsdp_header_I_t *I = self;
if(I){
TSK_FREE(I->value);
}
else{
TSK_DEBUG_ERROR("Null I header.");
}
return self;
}
static int tsdp_header_I_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_I_def_s =
{
sizeof(tsdp_header_I_t),
tsdp_header_I_create,
tsdp_header_I_destroy,
tsdp_header_I_cmp
};
const void *tsdp_header_I_def_t = &tsdp_header_I_def_s;

View File

@ -0,0 +1,299 @@
/* #line 1 "tsdp_parser_header_K.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_K.c
* @brief SDP "k=" header (Encryption Key).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_K.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 64 "tsdp_parser_header_K.rl" */
int tsdp_header_K_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_K_t *K = (const tsdp_header_K_t *)header;
if(K->value){
tsk_buffer_append(output, K->value, strlen(K->value));
}
return 0;
}
return -1;
}
tsdp_header_K_t *tsdp_header_K_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_K_t *hdr_K = TSDP_HEADER_K_CREATE_NULL();
const char *tag_start;
/* #line 74 "../src/headers/tsdp_header_K.c" */
static const char _tsdp_machine_parser_header_K_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsdp_machine_parser_header_K_key_offsets[] = {
0, 0, 1, 3, 5, 6, 7
};
static const char _tsdp_machine_parser_header_K_trans_keys[] = {
107, 32, 61, 13, 32, 13, 10, 0
};
static const char _tsdp_machine_parser_header_K_single_lengths[] = {
0, 1, 2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_K_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_K_index_offsets[] = {
0, 0, 2, 5, 8, 10, 12
};
static const char _tsdp_machine_parser_header_K_trans_targs[] = {
2, 0, 2, 3, 0, 5, 3, 4,
5, 4, 6, 0, 0, 0
};
static const char _tsdp_machine_parser_header_K_trans_actions[] = {
0, 0, 0, 0, 0, 7, 0, 1,
3, 0, 5, 0, 0, 0
};
static const int tsdp_machine_parser_header_K_start = 1;
static const int tsdp_machine_parser_header_K_first_final = 6;
static const int tsdp_machine_parser_header_K_error = 0;
static const int tsdp_machine_parser_header_K_en_main = 1;
/* #line 91 "tsdp_parser_header_K.rl" */
/* #line 119 "../src/headers/tsdp_header_K.c" */
{
cs = tsdp_machine_parser_header_K_start;
}
/* #line 92 "tsdp_parser_header_K.rl" */
/* #line 126 "../src/headers/tsdp_header_K.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 = _tsdp_machine_parser_header_K_trans_keys + _tsdp_machine_parser_header_K_key_offsets[cs];
_trans = _tsdp_machine_parser_header_K_index_offsets[cs];
_klen = _tsdp_machine_parser_header_K_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 = _tsdp_machine_parser_header_K_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:
cs = _tsdp_machine_parser_header_K_trans_targs[_trans];
if ( _tsdp_machine_parser_header_K_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_K_actions + _tsdp_machine_parser_header_K_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_K.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_K.rl" */
{
TSK_PARSER_SET_STRING(hdr_K->value);
}
break;
case 2:
/* #line 56 "tsdp_parser_header_K.rl" */
{
}
break;
/* #line 216 "../src/headers/tsdp_header_K.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 93 "tsdp_parser_header_K.rl" */
if( cs <
/* #line 232 "../src/headers/tsdp_header_K.c" */
6
/* #line 94 "tsdp_parser_header_K.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"k=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_K);
}
return hdr_K;
}
//========================================================
// K header object definition
//
static void* tsdp_header_K_create(void *self, va_list * app)
{
tsdp_header_K_t *K = self;
if(K)
{
TSDP_HEADER(K)->type = tsdp_htype_K;
TSDP_HEADER(K)->tostring = tsdp_header_K_tostring;
TSDP_HEADER(K)->rank = TSDP_HTYPE_P_RANK;
K->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_K_destroy(void *self)
{
tsdp_header_K_t *K = self;
if(K){
TSK_FREE(K->value);
}
else{
TSK_DEBUG_ERROR("Null K header.");
}
return self;
}
static int tsdp_header_K_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_K_def_s =
{
sizeof(tsdp_header_K_t),
tsdp_header_K_create,
tsdp_header_K_destroy,
tsdp_header_K_cmp
};
const void *tsdp_header_K_def_t = &tsdp_header_K_def_s;

View File

@ -0,0 +1,2 @@
/* #line 1 "tsdp_parser_header_M.rl" */

View File

@ -0,0 +1,362 @@
/* #line 1 "tsdp_parser_header_O.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_O.c
* @brief SDP "o=" header (Origin).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Uat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_O.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 89 "tsdp_parser_header_O.rl" */
int tsdp_header_O_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_O_t *O = (const tsdp_header_O_t *)header;
// o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com
return tsk_buffer_appendEx(output, "%s %u %u %s %s %s",
O->username,
O->sess_version,
O->sess_id,
O->nettype,
O->addrtype,
O->addr
);
return 0;
}
return -1;
}
tsdp_header_O_t *tsdp_header_O_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_O_t *hdr_O = TSDP_HEADER_O_CREATE_NULL();
const char *tag_start;
/* #line 81 "../src/headers/tsdp_header_O.c" */
static const char _tsdp_machine_parser_header_U_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3, 1, 4, 1, 5, 1, 6, 1,
7, 2, 0, 4, 2, 0, 5, 2,
0, 6
};
static const char _tsdp_machine_parser_header_U_key_offsets[] = {
0, 0, 1, 3, 4, 5, 7, 10,
12, 15, 16, 17, 18, 19, 20, 21,
22
};
static const char _tsdp_machine_parser_header_U_trans_keys[] = {
111, 32, 61, 32, 32, 48, 57, 32,
48, 57, 48, 57, 32, 48, 57, 32,
32, 32, 32, 13, 13, 10, 0
};
static const char _tsdp_machine_parser_header_U_single_lengths[] = {
0, 1, 2, 1, 1, 0, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1,
0
};
static const char _tsdp_machine_parser_header_U_range_lengths[] = {
0, 0, 0, 0, 0, 1, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0,
0
};
static const char _tsdp_machine_parser_header_U_index_offsets[] = {
0, 0, 2, 5, 7, 9, 11, 14,
16, 19, 21, 23, 25, 27, 29, 31,
33
};
static const char _tsdp_machine_parser_header_U_trans_targs[] = {
2, 0, 2, 3, 0, 3, 4, 5,
4, 6, 0, 7, 6, 0, 8, 0,
9, 8, 0, 11, 10, 11, 10, 13,
12, 13, 12, 15, 14, 15, 14, 16,
0, 0, 0
};
static const char _tsdp_machine_parser_header_U_trans_actions[] = {
0, 0, 0, 0, 0, 0, 1, 3,
0, 1, 0, 5, 0, 0, 1, 0,
7, 0, 0, 17, 1, 9, 0, 20,
1, 11, 0, 23, 1, 13, 0, 15,
0, 0, 0
};
static const int tsdp_machine_parser_header_U_start = 1;
static const int tsdp_machine_parser_header_U_first_final = 16;
static const int tsdp_machine_parser_header_U_error = 0;
static const int tsdp_machine_parser_header_U_en_main = 1;
/* #line 124 "tsdp_parser_header_O.rl" */
/* #line 144 "../src/headers/tsdp_header_O.c" */
{
cs = tsdp_machine_parser_header_U_start;
}
/* #line 125 "tsdp_parser_header_O.rl" */
/* #line 151 "../src/headers/tsdp_header_O.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 = _tsdp_machine_parser_header_U_trans_keys + _tsdp_machine_parser_header_U_key_offsets[cs];
_trans = _tsdp_machine_parser_header_U_index_offsets[cs];
_klen = _tsdp_machine_parser_header_U_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 = _tsdp_machine_parser_header_U_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:
cs = _tsdp_machine_parser_header_U_trans_targs[_trans];
if ( _tsdp_machine_parser_header_U_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_U_actions + _tsdp_machine_parser_header_U_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 47 "tsdp_parser_header_O.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 51 "tsdp_parser_header_O.rl" */
{
TSK_PARSER_SET_STRING(hdr_O->username);
}
break;
case 2:
/* #line 55 "tsdp_parser_header_O.rl" */
{
TSK_PARSER_SET_UINT(hdr_O->sess_id);
}
break;
case 3:
/* #line 59 "tsdp_parser_header_O.rl" */
{
TSK_PARSER_SET_UINT(hdr_O->sess_version);
}
break;
case 4:
/* #line 63 "tsdp_parser_header_O.rl" */
{
TSK_PARSER_SET_STRING(hdr_O->nettype);
}
break;
case 5:
/* #line 67 "tsdp_parser_header_O.rl" */
{
TSK_PARSER_SET_STRING(hdr_O->addrtype);
}
break;
case 6:
/* #line 71 "tsdp_parser_header_O.rl" */
{
TSK_PARSER_SET_STRING(hdr_O->addr);
}
break;
case 7:
/* #line 75 "tsdp_parser_header_O.rl" */
{
}
break;
/* #line 271 "../src/headers/tsdp_header_O.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 126 "tsdp_parser_header_O.rl" */
if( cs <
/* #line 287 "../src/headers/tsdp_header_O.c" */
16
/* #line 127 "tsdp_parser_header_O.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"o=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_O);
}
return hdr_O;
}
//========================================================
// O header object definition
//
static void* tsdp_header_O_create(void *self, va_list * app)
{
tsdp_header_O_t *O = self;
if(O)
{
TSDP_HEADER(O)->type = tsdp_htype_O;
TSDP_HEADER(O)->tostring = tsdp_header_O_tostring;
TSDP_HEADER(O)->rank = TSDP_HTYPE_O_RANK;
O->username = tsk_strdup(va_arg(*app, const char*));
O->sess_version = va_arg(*app, uint32_t);
O->sess_id = va_arg(*app, uint32_t);
O->nettype = tsk_strdup(va_arg(*app, const char*));
O->addrtype = tsk_strdup(va_arg(*app, const char*));
O->addr = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new O header.");
}
return self;
}
static void* tsdp_header_O_destroy(void *self)
{
tsdp_header_O_t *O = self;
if(O){
TSK_FREE(O->username);
TSK_FREE(O->nettype);
TSK_FREE(O->addrtype);
TSK_FREE(O->addr);
}
else{
TSK_DEBUG_ERROR("Null U header.");
}
return self;
}
static int tsdp_header_O_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_O_def_s =
{
sizeof(tsdp_header_O_t),
tsdp_header_O_create,
tsdp_header_O_destroy,
tsdp_header_O_cmp
};
const void *tsdp_header_O_def_t = &tsdp_header_O_def_s;

View File

@ -0,0 +1,299 @@
/* #line 1 "tsdp_parser_header_P.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_P.c
* @brief SDP "p=" header (Phone Number).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_P.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 64 "tsdp_parser_header_P.rl" */
int tsdp_header_P_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_P_t *P = (const tsdp_header_P_t *)header;
if(P->value){
tsk_buffer_append(output, P->value, strlen(P->value));
}
return 0;
}
return -1;
}
tsdp_header_P_t *tsdp_header_P_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_P_t *hdr_P = TSDP_HEADER_P_CREATE_NULL();
const char *tag_start;
/* #line 74 "../src/headers/tsdp_header_P.c" */
static const char _tsdp_machine_parser_header_P_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsdp_machine_parser_header_P_key_offsets[] = {
0, 0, 1, 3, 5, 6, 7
};
static const char _tsdp_machine_parser_header_P_trans_keys[] = {
112, 32, 61, 13, 32, 13, 10, 0
};
static const char _tsdp_machine_parser_header_P_single_lengths[] = {
0, 1, 2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_P_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_P_index_offsets[] = {
0, 0, 2, 5, 8, 10, 12
};
static const char _tsdp_machine_parser_header_P_trans_targs[] = {
2, 0, 2, 3, 0, 5, 3, 4,
5, 4, 6, 0, 0, 0
};
static const char _tsdp_machine_parser_header_P_trans_actions[] = {
0, 0, 0, 0, 0, 7, 0, 1,
3, 0, 5, 0, 0, 0
};
static const int tsdp_machine_parser_header_P_start = 1;
static const int tsdp_machine_parser_header_P_first_final = 6;
static const int tsdp_machine_parser_header_P_error = 0;
static const int tsdp_machine_parser_header_P_en_main = 1;
/* #line 91 "tsdp_parser_header_P.rl" */
/* #line 119 "../src/headers/tsdp_header_P.c" */
{
cs = tsdp_machine_parser_header_P_start;
}
/* #line 92 "tsdp_parser_header_P.rl" */
/* #line 126 "../src/headers/tsdp_header_P.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 = _tsdp_machine_parser_header_P_trans_keys + _tsdp_machine_parser_header_P_key_offsets[cs];
_trans = _tsdp_machine_parser_header_P_index_offsets[cs];
_klen = _tsdp_machine_parser_header_P_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 = _tsdp_machine_parser_header_P_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:
cs = _tsdp_machine_parser_header_P_trans_targs[_trans];
if ( _tsdp_machine_parser_header_P_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_P_actions + _tsdp_machine_parser_header_P_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_P.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_P.rl" */
{
TSK_PARSER_SET_STRING(hdr_P->value);
}
break;
case 2:
/* #line 56 "tsdp_parser_header_P.rl" */
{
}
break;
/* #line 216 "../src/headers/tsdp_header_P.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 93 "tsdp_parser_header_P.rl" */
if( cs <
/* #line 232 "../src/headers/tsdp_header_P.c" */
6
/* #line 94 "tsdp_parser_header_P.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"p=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_P);
}
return hdr_P;
}
//========================================================
// P header object definition
//
static void* tsdp_header_P_create(void *self, va_list * app)
{
tsdp_header_P_t *P = self;
if(P)
{
TSDP_HEADER(P)->type = tsdp_htype_P;
TSDP_HEADER(P)->tostring = tsdp_header_P_tostring;
TSDP_HEADER(P)->rank = TSDP_HTYPE_P_RANK;
P->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_P_destroy(void *self)
{
tsdp_header_P_t *P = self;
if(P){
TSK_FREE(P->value);
}
else{
TSK_DEBUG_ERROR("Null P header.");
}
return self;
}
static int tsdp_header_P_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_P_def_s =
{
sizeof(tsdp_header_P_t),
tsdp_header_P_create,
tsdp_header_P_destroy,
tsdp_header_P_cmp
};
const void *tsdp_header_P_def_t = &tsdp_header_P_def_s;

View File

@ -0,0 +1,338 @@
/* #line 1 "tsdp_parser_header_R.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_C.c
* @brief SDP "r=" header (Repeat Times).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_R.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 78 "tsdp_parser_header_R.rl" */
int tsdp_header_R_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_R_t *R = (const tsdp_header_R_t *)header;
const tsk_list_item_t* item;
// r=7d 1h 0 25h
tsk_buffer_appendEx(output, "%s %s",
R->repeat_interval,
R->typed_time
);
tsk_list_foreach(item, R->typed_times)
{
tsk_string_t* string = item->data;
tsk_buffer_appendEx(output, " %s", TSK_STRING_STR(string));
}
return 0;
}
return -1;
}
tsdp_header_R_t *tsdp_header_R_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_R_t *hdr_R = TSDP_HEADER_R_CREATE_NULL();
const char *tag_start;
/* #line 84 "../src/headers/tsdp_header_R.c" */
static const char _tsdp_machine_parser_header_R_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3
};
static const char _tsdp_machine_parser_header_R_key_offsets[] = {
0, 0, 1, 3, 6, 13, 15, 22,
24, 32, 33, 35, 36, 37
};
static const char _tsdp_machine_parser_header_R_trans_keys[] = {
114, 32, 61, 32, 48, 57, 32, 100,
104, 109, 115, 48, 57, 48, 57, 32,
100, 104, 109, 115, 48, 57, 48, 57,
13, 32, 100, 104, 109, 115, 48, 57,
10, 13, 32, 32, 32, 0
};
static const char _tsdp_machine_parser_header_R_single_lengths[] = {
0, 1, 2, 1, 5, 0, 5, 0,
6, 1, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_R_range_lengths[] = {
0, 0, 0, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_R_index_offsets[] = {
0, 0, 2, 5, 8, 15, 17, 24,
26, 34, 36, 39, 41, 43
};
static const char _tsdp_machine_parser_header_R_indicies[] = {
0, 1, 0, 2, 1, 2, 3, 1,
4, 6, 6, 6, 6, 5, 1, 7,
1, 8, 10, 10, 10, 10, 9, 1,
11, 1, 12, 8, 14, 14, 14, 14,
13, 1, 15, 1, 12, 8, 1, 8,
1, 4, 1, 1, 0
};
static const char _tsdp_machine_parser_header_R_trans_targs[] = {
2, 0, 3, 4, 5, 4, 12, 6,
7, 6, 11, 8, 9, 8, 10, 13
};
static const char _tsdp_machine_parser_header_R_trans_actions[] = {
0, 0, 0, 1, 3, 0, 0, 1,
5, 0, 0, 1, 5, 0, 0, 7
};
static const int tsdp_machine_parser_header_R_start = 1;
static const int tsdp_machine_parser_header_R_first_final = 13;
static const int tsdp_machine_parser_header_R_error = 0;
static const int tsdp_machine_parser_header_R_en_main = 1;
/* #line 115 "tsdp_parser_header_R.rl" */
/* #line 146 "../src/headers/tsdp_header_R.c" */
{
cs = tsdp_machine_parser_header_R_start;
}
/* #line 116 "tsdp_parser_header_R.rl" */
/* #line 153 "../src/headers/tsdp_header_R.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 = _tsdp_machine_parser_header_R_trans_keys + _tsdp_machine_parser_header_R_key_offsets[cs];
_trans = _tsdp_machine_parser_header_R_index_offsets[cs];
_klen = _tsdp_machine_parser_header_R_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 = _tsdp_machine_parser_header_R_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 = _tsdp_machine_parser_header_R_indicies[_trans];
cs = _tsdp_machine_parser_header_R_trans_targs[_trans];
if ( _tsdp_machine_parser_header_R_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_R_actions + _tsdp_machine_parser_header_R_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_R.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_R.rl" */
{
TSK_PARSER_SET_STRING(hdr_R->repeat_interval);
}
break;
case 2:
/* #line 56 "tsdp_parser_header_R.rl" */
{
if(!hdr_R->typed_time){
TSK_PARSER_SET_STRING(hdr_R->typed_time);
}
else{
TSK_PARSER_ADD_STRING(hdr_R->typed_times);
}
}
break;
case 3:
/* #line 65 "tsdp_parser_header_R.rl" */
{
}
break;
/* #line 255 "../src/headers/tsdp_header_R.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 117 "tsdp_parser_header_R.rl" */
if( cs <
/* #line 271 "../src/headers/tsdp_header_R.c" */
13
/* #line 118 "tsdp_parser_header_R.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"r=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_R);
}
return hdr_R;
}
//========================================================
// E header object definition
//
static void* tsdp_header_R_create(void *self, va_list * app)
{
tsdp_header_R_t *R = self;
if(R)
{
TSDP_HEADER(R)->type = tsdp_htype_R;
TSDP_HEADER(R)->tostring = tsdp_header_R_tostring;
TSDP_HEADER(R)->rank = TSDP_HTYPE_R_RANK;
}
else{
TSK_DEBUG_ERROR("Failed to create new E header.");
}
return self;
}
static void* tsdp_header_R_destroy(void *self)
{
tsdp_header_R_t *R = self;
if(R){
TSK_FREE(R->repeat_interval);
TSK_FREE(R->typed_time);
TSK_OBJECT_SAFE_FREE(R->typed_times);
}
else{
TSK_DEBUG_ERROR("Null P header.");
}
return self;
}
static int tsdp_header_R_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_R_def_s =
{
sizeof(tsdp_header_R_t),
tsdp_header_R_create,
tsdp_header_R_destroy,
tsdp_header_R_cmp
};
const void *tsdp_header_R_def_t = &tsdp_header_R_def_s;

View File

@ -0,0 +1,297 @@
/* #line 1 "tsdp_parser_header_S.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_S.c
* @brief SDP "s=" header (Session Name).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_S.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 63 "tsdp_parser_header_S.rl" */
int tsdp_header_S_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_S_t *S = (const tsdp_header_S_t *)header;
if(S->value){
tsk_buffer_append(output, S->value, strlen(S->value));
}
return 0;
}
return -1;
}
tsdp_header_S_t *tsdp_header_S_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_S_t *hdr_S = TSDP_HEADER_S_CREATE_NULL();
const char *tag_start;
/* #line 73 "../src/headers/tsdp_header_S.c" */
static const char _tsdp_machine_parser_header_S_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsdp_machine_parser_header_S_key_offsets[] = {
0, 0, 1, 3, 5, 6, 7
};
static const char _tsdp_machine_parser_header_S_trans_keys[] = {
115, 32, 61, 13, 32, 13, 10, 0
};
static const char _tsdp_machine_parser_header_S_single_lengths[] = {
0, 1, 2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_S_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_S_index_offsets[] = {
0, 0, 2, 5, 8, 10, 12
};
static const char _tsdp_machine_parser_header_S_trans_targs[] = {
2, 0, 2, 3, 0, 5, 3, 4,
5, 4, 6, 0, 0, 0
};
static const char _tsdp_machine_parser_header_S_trans_actions[] = {
0, 0, 0, 0, 0, 7, 0, 1,
3, 0, 5, 0, 0, 0
};
static const int tsdp_machine_parser_header_S_start = 1;
static const int tsdp_machine_parser_header_S_first_final = 6;
static const int tsdp_machine_parser_header_S_error = 0;
static const int tsdp_machine_parser_header_S_en_main = 1;
/* #line 90 "tsdp_parser_header_S.rl" */
/* #line 118 "../src/headers/tsdp_header_S.c" */
{
cs = tsdp_machine_parser_header_S_start;
}
/* #line 91 "tsdp_parser_header_S.rl" */
/* #line 125 "../src/headers/tsdp_header_S.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 = _tsdp_machine_parser_header_S_trans_keys + _tsdp_machine_parser_header_S_key_offsets[cs];
_trans = _tsdp_machine_parser_header_S_index_offsets[cs];
_klen = _tsdp_machine_parser_header_S_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 = _tsdp_machine_parser_header_S_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:
cs = _tsdp_machine_parser_header_S_trans_targs[_trans];
if ( _tsdp_machine_parser_header_S_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_S_actions + _tsdp_machine_parser_header_S_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 47 "tsdp_parser_header_S.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 51 "tsdp_parser_header_S.rl" */
{
TSK_PARSER_SET_STRING(hdr_S->value);
}
break;
case 2:
/* #line 55 "tsdp_parser_header_S.rl" */
{
}
break;
/* #line 215 "../src/headers/tsdp_header_S.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 92 "tsdp_parser_header_S.rl" */
if( cs <
/* #line 231 "../src/headers/tsdp_header_S.c" */
6
/* #line 93 "tsdp_parser_header_S.rl" */
){
TSK_OBJECT_SAFE_FREE(hdr_S);
}
return hdr_S;
}
//========================================================
// S header object definition
//
static void* tsdp_header_S_create(void *self, va_list * app)
{
tsdp_header_S_t *S = self;
if(S)
{
TSDP_HEADER(S)->type = tsdp_htype_S;
TSDP_HEADER(S)->tostring = tsdp_header_S_tostring;
TSDP_HEADER(S)->rank = TSDP_HTYPE_S_RANK;
S->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new S header.");
}
return self;
}
static void* tsdp_header_S_destroy(void *self)
{
tsdp_header_S_t *S = self;
if(S){
TSK_FREE(S->value);
}
else{
TSK_DEBUG_ERROR("Null S header.");
}
return self;
}
static int tsdp_header_S_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_S_def_s =
{
sizeof(tsdp_header_S_t),
tsdp_header_S_create,
tsdp_header_S_destroy,
tsdp_header_S_cmp
};
const void *tsdp_header_S_def_t = &tsdp_header_S_def_s;

View File

@ -0,0 +1,330 @@
/* #line 1 "tsdp_parser_header_T.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_T.c
* @brief SDP "t=" header (Timing).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Uat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_T.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 85 "tsdp_parser_header_T.rl" */
int tsdp_header_T_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_T_t *T = (const tsdp_header_T_t *)header;
const tsk_list_item_t *item;
//"t=3034423619 3042462419\r\n"
//"r=7d 1h 0 25h\r\n"
// IMPORTANT: Do not append the last CRLF (because we only print the header value).
tsk_buffer_appendEx(output, "%llu %llu",
T->start,
T->stop
);
tsk_list_foreach(item, T->repeat_fields)
{
if(TSK_LIST_IS_FIRST(T->repeat_fields, item)){
tsk_buffer_append(output, "\r\n", 2);
}
tsk_buffer_appendEx(output, "%c=", tsdp_header_get_nameex(TSDP_HEADER(item->data)));
TSDP_HEADER(item->data)->tostring(TSDP_HEADER(item->data), output);
//tsdp_header_tostring(TSDP_HEADER(item->data), output);
if(!TSK_LIST_IS_LAST(T->repeat_fields, item)){
tsk_buffer_append(output, "\r\n", 2);
}
}
return 0;
}
return -1;
}
tsdp_header_T_t *tsdp_header_T_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_T_t *hdr_T = TSDP_HEADER_T_CREATE_NULL();
const char *tag_start;
/* #line 94 "../src/headers/tsdp_header_T.c" */
static const char _tsdp_machine_parser_header_T_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3
};
static const char _tsdp_machine_parser_header_T_key_offsets[] = {
0, 0, 1, 3, 6, 9, 11, 14,
15
};
static const char _tsdp_machine_parser_header_T_trans_keys[] = {
116, 32, 61, 32, 48, 57, 32, 48,
57, 48, 57, 13, 48, 57, 10, 0
};
static const char _tsdp_machine_parser_header_T_single_lengths[] = {
0, 1, 2, 1, 1, 0, 1, 1,
0
};
static const char _tsdp_machine_parser_header_T_range_lengths[] = {
0, 0, 0, 1, 1, 1, 1, 0,
0
};
static const char _tsdp_machine_parser_header_T_index_offsets[] = {
0, 0, 2, 5, 8, 11, 13, 16,
18
};
static const char _tsdp_machine_parser_header_T_trans_targs[] = {
2, 0, 2, 3, 0, 3, 4, 0,
5, 4, 0, 6, 0, 7, 6, 0,
8, 0, 0, 0
};
static const char _tsdp_machine_parser_header_T_trans_actions[] = {
0, 0, 0, 0, 0, 0, 1, 0,
3, 0, 0, 1, 0, 5, 0, 0,
7, 0, 0, 0
};
static const int tsdp_machine_parser_header_T_start = 1;
static const int tsdp_machine_parser_header_T_first_final = 8;
static const int tsdp_machine_parser_header_T_error = 0;
static const int tsdp_machine_parser_header_T_en_main = 1;
/* #line 133 "tsdp_parser_header_T.rl" */
/* #line 146 "../src/headers/tsdp_header_T.c" */
{
cs = tsdp_machine_parser_header_T_start;
}
/* #line 134 "tsdp_parser_header_T.rl" */
/* #line 153 "../src/headers/tsdp_header_T.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 = _tsdp_machine_parser_header_T_trans_keys + _tsdp_machine_parser_header_T_key_offsets[cs];
_trans = _tsdp_machine_parser_header_T_index_offsets[cs];
_klen = _tsdp_machine_parser_header_T_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 = _tsdp_machine_parser_header_T_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:
cs = _tsdp_machine_parser_header_T_trans_targs[_trans];
if ( _tsdp_machine_parser_header_T_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_T_actions + _tsdp_machine_parser_header_T_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 47 "tsdp_parser_header_T.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 55 "tsdp_parser_header_T.rl" */
{
TSK_PARSER_SET_INTEGER_EX(hdr_T->start, uint64_t, atoi64);
}
break;
case 2:
/* #line 59 "tsdp_parser_header_T.rl" */
{
TSK_PARSER_SET_INTEGER_EX(hdr_T->stop, uint64_t, atoi64);
}
break;
case 3:
/* #line 73 "tsdp_parser_header_T.rl" */
{
}
break;
/* #line 249 "../src/headers/tsdp_header_T.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 135 "tsdp_parser_header_T.rl" */
if( cs <
/* #line 265 "../src/headers/tsdp_header_T.c" */
8
/* #line 136 "tsdp_parser_header_T.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"t=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_T);
}
return hdr_T;
}
//========================================================
// T header object definition
//
static void* tsdp_header_T_create(void *self, va_list * app)
{
tsdp_header_T_t *T = self;
if(T)
{
TSDP_HEADER(T)->type = tsdp_htype_T;
TSDP_HEADER(T)->tostring = tsdp_header_T_tostring;
TSDP_HEADER(T)->rank = TSDP_HTYPE_T_RANK;
}
else{
TSK_DEBUG_ERROR("Failed to create new U header.");
}
return self;
}
static void* tsdp_header_T_destroy(void *self)
{
tsdp_header_T_t *T = self;
if(T){
TSK_OBJECT_SAFE_FREE(T->repeat_fields);
}
else{
TSK_DEBUG_ERROR("Null U header.");
}
return self;
}
static int tsdp_header_T_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_T_def_s =
{
sizeof(tsdp_header_T_t),
tsdp_header_T_create,
tsdp_header_T_destroy,
tsdp_header_T_cmp
};
const void *tsdp_header_T_def_t = &tsdp_header_T_def_s;

View File

@ -0,0 +1,298 @@
/* #line 1 "tsdp_parser_header_U.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_U.c
* @brief SDP "u=" header (URI).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Uat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_U.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 63 "tsdp_parser_header_U.rl" */
int tsdp_header_U_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_U_t *U = (const tsdp_header_U_t *)header;
if(U->value){
tsk_buffer_append(output, U->value, strlen(U->value));
}
return 0;
}
return -1;
}
tsdp_header_U_t *tsdp_header_U_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_U_t *hdr_U = TSDP_HEADER_U_CREATE_NULL();
const char *tag_start;
/* #line 73 "../src/headers/tsdp_header_U.c" */
static const char _tsdp_machine_parser_header_U_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsdp_machine_parser_header_U_key_offsets[] = {
0, 0, 1, 3, 5, 6, 7
};
static const char _tsdp_machine_parser_header_U_trans_keys[] = {
117, 32, 61, 13, 32, 13, 10, 0
};
static const char _tsdp_machine_parser_header_U_single_lengths[] = {
0, 1, 2, 2, 1, 1, 0
};
static const char _tsdp_machine_parser_header_U_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0
};
static const char _tsdp_machine_parser_header_U_index_offsets[] = {
0, 0, 2, 5, 8, 10, 12
};
static const char _tsdp_machine_parser_header_U_trans_targs[] = {
2, 0, 2, 3, 0, 5, 3, 4,
5, 4, 6, 0, 0, 0
};
static const char _tsdp_machine_parser_header_U_trans_actions[] = {
0, 0, 0, 0, 0, 7, 0, 1,
3, 0, 5, 0, 0, 0
};
static const int tsdp_machine_parser_header_U_start = 1;
static const int tsdp_machine_parser_header_U_first_final = 6;
static const int tsdp_machine_parser_header_U_error = 0;
static const int tsdp_machine_parser_header_U_en_main = 1;
/* #line 90 "tsdp_parser_header_U.rl" */
/* #line 118 "../src/headers/tsdp_header_U.c" */
{
cs = tsdp_machine_parser_header_U_start;
}
/* #line 91 "tsdp_parser_header_U.rl" */
/* #line 125 "../src/headers/tsdp_header_U.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 = _tsdp_machine_parser_header_U_trans_keys + _tsdp_machine_parser_header_U_key_offsets[cs];
_trans = _tsdp_machine_parser_header_U_index_offsets[cs];
_klen = _tsdp_machine_parser_header_U_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 = _tsdp_machine_parser_header_U_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:
cs = _tsdp_machine_parser_header_U_trans_targs[_trans];
if ( _tsdp_machine_parser_header_U_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_U_actions + _tsdp_machine_parser_header_U_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 47 "tsdp_parser_header_U.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 51 "tsdp_parser_header_U.rl" */
{
TSK_PARSER_SET_STRING(hdr_U->value);
}
break;
case 2:
/* #line 55 "tsdp_parser_header_U.rl" */
{
}
break;
/* #line 215 "../src/headers/tsdp_header_U.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 92 "tsdp_parser_header_U.rl" */
if( cs <
/* #line 231 "../src/headers/tsdp_header_U.c" */
6
/* #line 93 "tsdp_parser_header_U.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"u=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_U);
}
return hdr_U;
}
//========================================================
// U header object definition
//
static void* tsdp_header_U_create(void *self, va_list * app)
{
tsdp_header_U_t *U = self;
if(U)
{
TSDP_HEADER(U)->type = tsdp_htype_U;
TSDP_HEADER(U)->tostring = tsdp_header_U_tostring;
TSDP_HEADER(U)->rank = TSDP_HTYPE_U_RANK;
U->value = tsk_strdup(va_arg(*app, const char*));
}
else{
TSK_DEBUG_ERROR("Failed to create new U header.");
}
return self;
}
static void* tsdp_header_U_destroy(void *self)
{
tsdp_header_U_t *U = self;
if(U){
TSK_FREE(U->value);
}
else{
TSK_DEBUG_ERROR("Null U header.");
}
return self;
}
static int tsdp_header_U_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_U_def_s =
{
sizeof(tsdp_header_U_t),
tsdp_header_U_create,
tsdp_header_U_destroy,
tsdp_header_U_cmp
};
const void *tsdp_header_U_def_t = &tsdp_header_U_def_s;

View File

@ -0,0 +1,297 @@
/* #line 1 "tsdp_parser_header_V.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_V.c
* @brief SDP "v=" header (Protocol Version).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_V.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 63 "tsdp_parser_header_V.rl" */
int tsdp_header_V_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_V_t *V = (const tsdp_header_V_t *)header;
if(V->version >=0){
tsk_buffer_appendEx(output, "%d", V->version);
}
return 0;
}
return -1;
}
tsdp_header_V_t *tsdp_header_V_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_V_t *hdr_V = TSDP_HEADER_V_CREATE_NULL();
const char *tag_start;
/* #line 73 "../src/headers/tsdp_header_V.c" */
static const char _tsdp_machine_parser_header_V_actions[] = {
0, 1, 0, 1, 1, 1, 2
};
static const char _tsdp_machine_parser_header_V_key_offsets[] = {
0, 0, 1, 3, 6, 9, 10
};
static const char _tsdp_machine_parser_header_V_trans_keys[] = {
118, 32, 61, 32, 48, 57, 13, 48,
57, 10, 0
};
static const char _tsdp_machine_parser_header_V_single_lengths[] = {
0, 1, 2, 1, 1, 1, 0
};
static const char _tsdp_machine_parser_header_V_range_lengths[] = {
0, 0, 0, 1, 1, 0, 0
};
static const char _tsdp_machine_parser_header_V_index_offsets[] = {
0, 0, 2, 5, 8, 11, 13
};
static const char _tsdp_machine_parser_header_V_trans_targs[] = {
2, 0, 2, 3, 0, 3, 4, 0,
5, 4, 0, 6, 0, 0, 0
};
static const char _tsdp_machine_parser_header_V_trans_actions[] = {
0, 0, 0, 0, 0, 0, 1, 0,
3, 0, 0, 5, 0, 0, 0
};
static const int tsdp_machine_parser_header_V_start = 1;
static const int tsdp_machine_parser_header_V_first_final = 6;
static const int tsdp_machine_parser_header_V_error = 0;
static const int tsdp_machine_parser_header_V_en_main = 1;
/* #line 90 "tsdp_parser_header_V.rl" */
/* #line 118 "../src/headers/tsdp_header_V.c" */
{
cs = tsdp_machine_parser_header_V_start;
}
/* #line 91 "tsdp_parser_header_V.rl" */
/* #line 125 "../src/headers/tsdp_header_V.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 = _tsdp_machine_parser_header_V_trans_keys + _tsdp_machine_parser_header_V_key_offsets[cs];
_trans = _tsdp_machine_parser_header_V_index_offsets[cs];
_klen = _tsdp_machine_parser_header_V_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 = _tsdp_machine_parser_header_V_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:
cs = _tsdp_machine_parser_header_V_trans_targs[_trans];
if ( _tsdp_machine_parser_header_V_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_V_actions + _tsdp_machine_parser_header_V_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 47 "tsdp_parser_header_V.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 51 "tsdp_parser_header_V.rl" */
{
TSK_PARSER_SET_INT(hdr_V->version);
}
break;
case 2:
/* #line 55 "tsdp_parser_header_V.rl" */
{
}
break;
/* #line 215 "../src/headers/tsdp_header_V.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 92 "tsdp_parser_header_V.rl" */
if( cs <
/* #line 231 "../src/headers/tsdp_header_V.c" */
6
/* #line 93 "tsdp_parser_header_V.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"v=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_V);
}
return hdr_V;
}
//========================================================
// V header object definition
//
static void* tsdp_header_V_create(void *self, va_list * app)
{
tsdp_header_V_t *V = self;
if(V)
{
TSDP_HEADER(V)->type = tsdp_htype_V;
TSDP_HEADER(V)->tostring = tsdp_header_V_tostring;
TSDP_HEADER(V)->rank = TSDP_HTYPE_V_RANK;
V->version = va_arg(*app, int32_t);
}
else{
TSK_DEBUG_ERROR("Failed to create new V header.");
}
return self;
}
static void* tsdp_header_V_destroy(void *self)
{
tsdp_header_V_t *V = self;
if(V){
}
else{
TSK_DEBUG_ERROR("Null V header.");
}
return self;
}
static int tsdp_header_V_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_V_def_s =
{
sizeof(tsdp_header_V_t),
tsdp_header_V_create,
tsdp_header_V_destroy,
tsdp_header_V_cmp
};
const void *tsdp_header_V_def_t = &tsdp_header_V_def_s;

View File

@ -0,0 +1,431 @@
/* #line 1 "tsdp_parser_header_Z.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_header_Z.c
* @brief SDP "z=" header (Time Zones).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Iat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/headers/tsdp_header_Z.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_string.h"
#include <string.h>
/***********************************
* Ragel state machine.
*/
/* #line 96 "tsdp_parser_header_Z.rl" */
int tsdp_header_Z_tostring(const tsdp_header_t* header, tsk_buffer_t* output)
{
if(header)
{
const tsdp_header_Z_t *Z = (const tsdp_header_Z_t *)header;
const tsk_list_item_t *item;
const tsdp_zone_t* zone;
tsk_list_foreach(item, Z->zones)
{
zone = item->data;
// time SP ["-"] typed-time
tsk_buffer_appendEx(output, "%s%llu %s%s",
TSK_LIST_IS_FIRST(Z->zones, item) ? "" : " ",
zone->time,
zone->shifted_back ? "-" : "",
zone->typed_time
);
}
}
return -1;
}
tsdp_header_Z_t *tsdp_header_Z_parse(const char *data, size_t size)
{
int cs = 0;
const char *p = data;
const char *pe = p + size;
const char *eof = pe;
tsdp_header_Z_t *hdr_Z = TSDP_HEADER_Z_CREATE_NULL();
tsdp_zone_t* zone = TSDP_NULL;
const char *tag_start;
/* #line 85 "../src/headers/tsdp_header_Z.c" */
static const char _tsdp_machine_parser_header_Z_actions[] = {
0, 1, 0, 1, 3, 1, 4, 1,
6, 2, 1, 0, 2, 4, 2, 2,
5, 0, 3, 4, 2, 1
};
static const char _tsdp_machine_parser_header_Z_key_offsets[] = {
0, 0, 1, 3, 5, 8, 11, 13,
21, 22, 24, 27, 30, 32, 40, 42,
44
};
static const char _tsdp_machine_parser_header_Z_trans_keys[] = {
122, 32, 61, 48, 57, 32, 48, 57,
45, 48, 57, 48, 57, 13, 32, 100,
104, 109, 115, 48, 57, 10, 48, 57,
32, 48, 57, 45, 48, 57, 48, 57,
13, 32, 100, 104, 109, 115, 48, 57,
13, 32, 13, 32, 0
};
static const char _tsdp_machine_parser_header_Z_single_lengths[] = {
0, 1, 2, 0, 1, 1, 0, 6,
1, 0, 1, 1, 0, 6, 2, 2,
0
};
static const char _tsdp_machine_parser_header_Z_range_lengths[] = {
0, 0, 0, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0, 0,
0
};
static const char _tsdp_machine_parser_header_Z_index_offsets[] = {
0, 0, 2, 5, 7, 10, 13, 15,
23, 25, 27, 30, 33, 35, 43, 46,
49
};
static const char _tsdp_machine_parser_header_Z_indicies[] = {
0, 1, 0, 2, 1, 3, 1, 4,
5, 1, 6, 7, 1, 8, 1, 9,
10, 12, 12, 12, 12, 11, 1, 13,
1, 14, 1, 15, 16, 1, 17, 18,
1, 19, 1, 20, 21, 23, 23, 23,
23, 22, 1, 20, 21, 1, 9, 10,
1, 1, 0
};
static const char _tsdp_machine_parser_header_Z_trans_targs[] = {
2, 0, 3, 4, 5, 4, 6, 7,
7, 8, 9, 7, 15, 16, 10, 11,
10, 12, 13, 13, 8, 9, 13, 14
};
static const char _tsdp_machine_parser_header_Z_trans_actions[] = {
0, 0, 0, 9, 3, 0, 0, 1,
15, 18, 18, 0, 0, 7, 1, 3,
0, 0, 1, 15, 12, 5, 0, 0
};
static const int tsdp_machine_parser_header_Z_start = 1;
static const int tsdp_machine_parser_header_Z_first_final = 16;
static const int tsdp_machine_parser_header_Z_error = 0;
static const int tsdp_machine_parser_header_Z_en_main = 1;
/* #line 134 "tsdp_parser_header_Z.rl" */
/* #line 156 "../src/headers/tsdp_header_Z.c" */
{
cs = tsdp_machine_parser_header_Z_start;
}
/* #line 135 "tsdp_parser_header_Z.rl" */
/* #line 163 "../src/headers/tsdp_header_Z.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 = _tsdp_machine_parser_header_Z_trans_keys + _tsdp_machine_parser_header_Z_key_offsets[cs];
_trans = _tsdp_machine_parser_header_Z_index_offsets[cs];
_klen = _tsdp_machine_parser_header_Z_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 = _tsdp_machine_parser_header_Z_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 = _tsdp_machine_parser_header_Z_indicies[_trans];
cs = _tsdp_machine_parser_header_Z_trans_targs[_trans];
if ( _tsdp_machine_parser_header_Z_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_parser_header_Z_actions + _tsdp_machine_parser_header_Z_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 48 "tsdp_parser_header_Z.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 52 "tsdp_parser_header_Z.rl" */
{
if(!zone){
zone = TSDP_ZONE_CREATE_NULL();
}
}
break;
case 2:
/* #line 58 "tsdp_parser_header_Z.rl" */
{
if(zone){
tsk_list_push_back_data(hdr_Z->zones,(void**)&zone);
}
}
break;
case 3:
/* #line 64 "tsdp_parser_header_Z.rl" */
{
if(zone){
TSK_PARSER_SET_INTEGER_EX(zone->time, uint64_t, atoi64);
}
}
break;
case 4:
/* #line 70 "tsdp_parser_header_Z.rl" */
{
if(zone){
TSK_PARSER_SET_STRING(zone->typed_time);
}
}
break;
case 5:
/* #line 76 "tsdp_parser_header_Z.rl" */
{
if(zone){
zone->shifted_back = 1;
}
}
break;
case 6:
/* #line 82 "tsdp_parser_header_Z.rl" */
{
}
break;
/* #line 288 "../src/headers/tsdp_header_Z.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 136 "tsdp_parser_header_Z.rl" */
if(zone){
TSK_OBJECT_SAFE_FREE(zone);
}
if( cs <
/* #line 308 "../src/headers/tsdp_header_Z.c" */
16
/* #line 141 "tsdp_parser_header_Z.rl" */
){
TSK_DEBUG_ERROR("Failed to parse \"b=\" header.");
TSK_OBJECT_SAFE_FREE(hdr_Z);
}
return hdr_Z;
}
//========================================================
// Z header object definition
//
static void* tsdp_header_Z_create(void *self, va_list * app)
{
tsdp_header_Z_t *Z = self;
if(Z)
{
TSDP_HEADER(Z)->type = tsdp_htype_Z;
TSDP_HEADER(Z)->tostring = tsdp_header_Z_tostring;
TSDP_HEADER(Z)->rank = TSDP_HTYPE_Z_RANK;
if((Z->zones = TSK_LIST_CREATE())){
uint64_t time = va_arg(*app, uint64_t);
unsigned shifted_back = va_arg(*app, unsigned);
const char* typed_time = va_arg(*app, const char*);
if(typed_time){
tsdp_zone_t *zone;
if((zone = TSDP_ZONE_CREATE(time, shifted_back, typed_time))){
tsk_list_push_back_data(Z->zones,(void**)&zone);
}
}
}
}
else{
TSK_DEBUG_ERROR("Failed to create new Z header.");
}
return self;
}
static void* tsdp_header_Z_destroy(void *self)
{
tsdp_header_Z_t *Z = self;
if(Z){
TSK_OBJECT_SAFE_FREE(Z->zones);
}
else{
TSK_DEBUG_ERROR("Null Z header.");
}
return self;
}
static int tsdp_header_Z_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
if(obj1 && obj2){
return tsdp_header_rank_cmp(obj1, obj2);
}
else{
return -1;
}
}
static const tsk_object_def_t tsdp_header_Z_def_s =
{
sizeof(tsdp_header_Z_t),
tsdp_header_Z_create,
tsdp_header_Z_destroy,
tsdp_header_Z_cmp
};
const void *tsdp_header_Z_def_t = &tsdp_header_Z_def_s;
//========================================================
// Zone object definition
//
static void* tsdp_zone_create(void *self, va_list * app)
{
tsdp_zone_t *zone = self;
if(zone)
{
zone->time = va_arg(*app, uint64_t);
zone->shifted_back = va_arg(*app, unsigned);
zone->typed_time = tsk_strdup( va_arg(*app, const char*) );
}
else{
TSK_DEBUG_ERROR("Failed to create new zone object.");
}
return self;
}
static void* tsdp_zone_destroy(void *self)
{
tsdp_zone_t *zone = self;
if(zone){
TSK_FREE(zone->typed_time);
}
else{
TSK_DEBUG_ERROR("Null zone object.");
}
return self;
}
static const tsk_object_def_t tsdp_zone_def_s =
{
sizeof(tsdp_zone_t),
tsdp_zone_create,
tsdp_zone_destroy,
0
};
const void *tsdp_zone_def_t = &tsdp_zone_def_s;

View File

@ -0,0 +1,872 @@
/* #line 1 "tsdp_parser_message.rl" */
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_machine_message.rl
* @brief Ragel file.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/parsers/tsdp_parser_message.h"
#include "tinySDP/headers/tsdp_header_B.h"
#include "tinySDP/headers/tsdp_header_C.h"
#include "tinySDP/headers/tsdp_header_Dummy.h"
#include "tinySDP/headers/tsdp_header_E.h"
#include "tinySDP/headers/tsdp_header_I.h"
#include "tinySDP/headers/tsdp_header_K.h"
#include "tinySDP/headers/tsdp_header_O.h"
#include "tinySDP/headers/tsdp_header_P.h"
#include "tinySDP/headers/tsdp_header_R.h"
#include "tinySDP/headers/tsdp_header_S.h"
#include "tinySDP/headers/tsdp_header_T.h"
#include "tinySDP/headers/tsdp_header_U.h"
#include "tinySDP/headers/tsdp_header_V.h"
#include "tinySDP/headers/tsdp_header_Z.h"
#include "tsk_debug.h"
/* #line 225 "tsdp_parser_message.rl" */
/* Ragel data */
/* #line 57 "../src/parsers/tsdp_parser_message.c" */
static const char _tsdp_machine_message_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3, 1, 4, 1, 5, 1, 6, 1,
7, 1, 8, 1, 9, 1, 10, 1,
11, 1, 12, 1, 13, 1, 14, 1,
15, 1, 16, 2, 1, 0, 2, 2,
0, 2, 3, 0, 2, 4, 0, 2,
5, 0, 2, 6, 0, 2, 7, 0,
2, 8, 0, 2, 9, 0, 2, 10,
0, 2, 11, 0, 2, 12, 0, 2,
13, 0, 2, 14, 0, 2, 15, 0,
2, 16, 0
};
static const short _tsdp_machine_message_key_offsets[] = {
0, 0, 2, 3, 4, 6, 7, 8,
10, 11, 12, 14, 15, 16, 18, 19,
20, 22, 23, 24, 26, 27, 28, 30,
31, 32, 34, 35, 36, 38, 39, 40,
42, 43, 44, 46, 47, 48, 50, 51,
52, 54, 55, 56, 58, 59, 60, 62,
63, 64, 98, 132, 166, 200, 234, 268,
302, 336, 370, 404, 438, 472, 506, 540,
574, 608
};
static const char _tsdp_machine_message_trans_keys[] = {
32, 61, 13, 10, 32, 61, 13, 10,
32, 61, 13, 10, 32, 61, 13, 10,
32, 61, 13, 10, 32, 61, 13, 10,
32, 61, 13, 10, 32, 61, 13, 10,
32, 61, 13, 10, 32, 61, 13, 10,
32, 61, 13, 10, 32, 61, 13, 10,
32, 61, 13, 10, 32, 61, 13, 10,
32, 61, 13, 10, 32, 61, 13, 10,
65, 66, 67, 69, 73, 75, 77, 79,
80, 82, 83, 84, 85, 86, 90, 97,
98, 99, 101, 105, 107, 109, 111, 112,
114, 115, 116, 117, 118, 122, 68, 89,
100, 121, 65, 66, 67, 69, 73, 75,
77, 79, 80, 82, 83, 84, 85, 86,
90, 97, 98, 99, 101, 105, 107, 109,
111, 112, 114, 115, 116, 117, 118, 122,
68, 89, 100, 121, 65, 66, 67, 69,
73, 75, 77, 79, 80, 82, 83, 84,
85, 86, 90, 97, 98, 99, 101, 105,
107, 109, 111, 112, 114, 115, 116, 117,
118, 122, 68, 89, 100, 121, 65, 66,
67, 69, 73, 75, 77, 79, 80, 82,
83, 84, 85, 86, 90, 97, 98, 99,
101, 105, 107, 109, 111, 112, 114, 115,
116, 117, 118, 122, 68, 89, 100, 121,
65, 66, 67, 69, 73, 75, 77, 79,
80, 82, 83, 84, 85, 86, 90, 97,
98, 99, 101, 105, 107, 109, 111, 112,
114, 115, 116, 117, 118, 122, 68, 89,
100, 121, 65, 66, 67, 69, 73, 75,
77, 79, 80, 82, 83, 84, 85, 86,
90, 97, 98, 99, 101, 105, 107, 109,
111, 112, 114, 115, 116, 117, 118, 122,
68, 89, 100, 121, 65, 66, 67, 69,
73, 75, 77, 79, 80, 82, 83, 84,
85, 86, 90, 97, 98, 99, 101, 105,
107, 109, 111, 112, 114, 115, 116, 117,
118, 122, 68, 89, 100, 121, 65, 66,
67, 69, 73, 75, 77, 79, 80, 82,
83, 84, 85, 86, 90, 97, 98, 99,
101, 105, 107, 109, 111, 112, 114, 115,
116, 117, 118, 122, 68, 89, 100, 121,
65, 66, 67, 69, 73, 75, 77, 79,
80, 82, 83, 84, 85, 86, 90, 97,
98, 99, 101, 105, 107, 109, 111, 112,
114, 115, 116, 117, 118, 122, 68, 89,
100, 121, 65, 66, 67, 69, 73, 75,
77, 79, 80, 82, 83, 84, 85, 86,
90, 97, 98, 99, 101, 105, 107, 109,
111, 112, 114, 115, 116, 117, 118, 122,
68, 89, 100, 121, 65, 66, 67, 69,
73, 75, 77, 79, 80, 82, 83, 84,
85, 86, 90, 97, 98, 99, 101, 105,
107, 109, 111, 112, 114, 115, 116, 117,
118, 122, 68, 89, 100, 121, 65, 66,
67, 69, 73, 75, 77, 79, 80, 82,
83, 84, 85, 86, 90, 97, 98, 99,
101, 105, 107, 109, 111, 112, 114, 115,
116, 117, 118, 122, 68, 89, 100, 121,
65, 66, 67, 69, 73, 75, 77, 79,
80, 82, 83, 84, 85, 86, 90, 97,
98, 99, 101, 105, 107, 109, 111, 112,
114, 115, 116, 117, 118, 122, 68, 89,
100, 121, 65, 66, 67, 69, 73, 75,
77, 79, 80, 82, 83, 84, 85, 86,
90, 97, 98, 99, 101, 105, 107, 109,
111, 112, 114, 115, 116, 117, 118, 122,
68, 89, 100, 121, 65, 66, 67, 69,
73, 75, 77, 79, 80, 82, 83, 84,
85, 86, 90, 97, 98, 99, 101, 105,
107, 109, 111, 112, 114, 115, 116, 117,
118, 122, 68, 89, 100, 121, 65, 66,
67, 69, 73, 75, 77, 79, 80, 82,
83, 84, 85, 86, 90, 97, 98, 99,
101, 105, 107, 109, 111, 112, 114, 115,
116, 117, 118, 122, 68, 89, 100, 121,
65, 66, 67, 69, 73, 75, 77, 79,
80, 82, 83, 84, 85, 86, 90, 97,
98, 99, 101, 105, 107, 109, 111, 112,
114, 115, 116, 117, 118, 122, 68, 89,
100, 121, 0
};
static const char _tsdp_machine_message_single_lengths[] = {
0, 2, 1, 1, 2, 1, 1, 2,
1, 1, 2, 1, 1, 2, 1, 1,
2, 1, 1, 2, 1, 1, 2, 1,
1, 2, 1, 1, 2, 1, 1, 2,
1, 1, 2, 1, 1, 2, 1, 1,
2, 1, 1, 2, 1, 1, 2, 1,
1, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30
};
static const char _tsdp_machine_message_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, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2,
2, 2
};
static const short _tsdp_machine_message_index_offsets[] = {
0, 0, 3, 5, 7, 10, 12, 14,
17, 19, 21, 24, 26, 28, 31, 33,
35, 38, 40, 42, 45, 47, 49, 52,
54, 56, 59, 61, 63, 66, 68, 70,
73, 75, 77, 80, 82, 84, 87, 89,
91, 94, 96, 98, 101, 103, 105, 108,
110, 112, 145, 178, 211, 244, 277, 310,
343, 376, 409, 442, 475, 508, 541, 574,
607, 640
};
static const char _tsdp_machine_message_trans_targs[] = {
1, 2, 0, 3, 2, 50, 0, 4,
5, 0, 6, 5, 51, 0, 7, 8,
0, 9, 8, 52, 0, 10, 11, 0,
12, 11, 53, 0, 13, 14, 0, 15,
14, 54, 0, 16, 17, 0, 18, 17,
55, 0, 19, 20, 0, 21, 20, 56,
0, 22, 23, 0, 24, 23, 57, 0,
25, 26, 0, 27, 26, 58, 0, 28,
29, 0, 30, 29, 59, 0, 31, 32,
0, 33, 32, 60, 0, 34, 35, 0,
36, 35, 61, 0, 37, 38, 0, 39,
38, 62, 0, 40, 41, 0, 42, 41,
63, 0, 43, 44, 0, 45, 44, 64,
0, 46, 47, 0, 48, 47, 65, 0,
1, 4, 7, 13, 16, 19, 22, 25,
28, 31, 34, 37, 40, 43, 46, 1,
4, 7, 13, 16, 19, 22, 25, 28,
31, 34, 37, 40, 43, 46, 10, 10,
0, 1, 4, 7, 13, 16, 19, 22,
25, 28, 31, 34, 37, 40, 43, 46,
1, 4, 7, 13, 16, 19, 22, 25,
28, 31, 34, 37, 40, 43, 46, 10,
10, 0, 1, 4, 7, 13, 16, 19,
22, 25, 28, 31, 34, 37, 40, 43,
46, 1, 4, 7, 13, 16, 19, 22,
25, 28, 31, 34, 37, 40, 43, 46,
10, 10, 0, 1, 4, 7, 13, 16,
19, 22, 25, 28, 31, 34, 37, 40,
43, 46, 1, 4, 7, 13, 16, 19,
22, 25, 28, 31, 34, 37, 40, 43,
46, 10, 10, 0, 1, 4, 7, 13,
16, 19, 22, 25, 28, 31, 34, 37,
40, 43, 46, 1, 4, 7, 13, 16,
19, 22, 25, 28, 31, 34, 37, 40,
43, 46, 10, 10, 0, 1, 4, 7,
13, 16, 19, 22, 25, 28, 31, 34,
37, 40, 43, 46, 1, 4, 7, 13,
16, 19, 22, 25, 28, 31, 34, 37,
40, 43, 46, 10, 10, 0, 1, 4,
7, 13, 16, 19, 22, 25, 28, 31,
34, 37, 40, 43, 46, 1, 4, 7,
13, 16, 19, 22, 25, 28, 31, 34,
37, 40, 43, 46, 10, 10, 0, 1,
4, 7, 13, 16, 19, 22, 25, 28,
31, 34, 37, 40, 43, 46, 1, 4,
7, 13, 16, 19, 22, 25, 28, 31,
34, 37, 40, 43, 46, 10, 10, 0,
1, 4, 7, 13, 16, 19, 22, 25,
28, 31, 34, 37, 40, 43, 46, 1,
4, 7, 13, 16, 19, 22, 25, 28,
31, 34, 37, 40, 43, 46, 10, 10,
0, 1, 4, 7, 13, 16, 19, 22,
25, 28, 31, 34, 37, 40, 43, 46,
1, 4, 7, 13, 16, 19, 22, 25,
28, 31, 34, 37, 40, 43, 46, 10,
10, 0, 1, 4, 7, 13, 16, 19,
22, 25, 28, 31, 34, 37, 40, 43,
46, 1, 4, 7, 13, 16, 19, 22,
25, 28, 31, 34, 37, 40, 43, 46,
10, 10, 0, 1, 4, 7, 13, 16,
19, 22, 25, 28, 31, 34, 37, 40,
43, 46, 1, 4, 7, 13, 16, 19,
22, 25, 28, 31, 34, 37, 40, 43,
46, 10, 10, 0, 1, 4, 7, 13,
16, 19, 22, 25, 28, 31, 34, 37,
40, 43, 46, 1, 4, 7, 13, 16,
19, 22, 25, 28, 31, 34, 37, 40,
43, 46, 10, 10, 0, 1, 4, 7,
13, 16, 19, 22, 25, 28, 31, 34,
37, 40, 43, 46, 1, 4, 7, 13,
16, 19, 22, 25, 28, 31, 34, 37,
40, 43, 46, 10, 10, 0, 1, 4,
7, 13, 16, 19, 22, 25, 28, 31,
34, 37, 40, 43, 46, 1, 4, 7,
13, 16, 19, 22, 25, 28, 31, 34,
37, 40, 43, 46, 10, 10, 0, 1,
4, 7, 13, 16, 19, 22, 25, 28,
31, 34, 37, 40, 43, 46, 1, 4,
7, 13, 16, 19, 22, 25, 28, 31,
34, 37, 40, 43, 46, 10, 10, 0,
1, 4, 7, 13, 16, 19, 22, 25,
28, 31, 34, 37, 40, 43, 46, 1,
4, 7, 13, 16, 19, 22, 25, 28,
31, 34, 37, 40, 43, 46, 10, 10,
0, 0
};
static const char _tsdp_machine_message_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, 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, 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, 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,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
0, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 0, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 0, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 0, 44, 44, 44, 44,
44, 44, 44, 44, 44, 44, 44, 44,
44, 44, 44, 44, 44, 44, 44, 44,
44, 44, 44, 44, 44, 44, 44, 44,
44, 44, 44, 44, 0, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 0, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 0, 53,
53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 0,
56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56,
0, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59,
59, 0, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 0, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 0, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 0, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 0, 74, 74,
74, 74, 74, 74, 74, 74, 74, 74,
74, 74, 74, 74, 74, 74, 74, 74,
74, 74, 74, 74, 74, 74, 74, 74,
74, 74, 74, 74, 74, 74, 0, 77,
77, 77, 77, 77, 77, 77, 77, 77,
77, 77, 77, 77, 77, 77, 77, 77,
77, 77, 77, 77, 77, 77, 77, 77,
77, 77, 77, 77, 77, 77, 77, 0,
80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80,
0, 0
};
static const char _tsdp_machine_message_eof_actions[] = {
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, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 5, 7, 9, 11, 13,
15, 17, 19, 21, 23, 25, 27, 29,
31, 33
};
static const int tsdp_machine_message_start = 49;
static const int tsdp_machine_message_first_final = 49;
static const int tsdp_machine_message_error = 0;
static const int tsdp_machine_message_en_main = 49;
/* #line 229 "tsdp_parser_message.rl" */
tsdp_message_t* tsdp_message_parse(const void *input, size_t size)
{
tsdp_message_t* sdp_msg = TSDP_NULL;
const char* tag_start = TSDP_NULL;
tsdp_header_t *header = TSDP_NULL;
tsdp_header_T_t *hdr_T = TSDP_NULL;
/* Ragel variables */
int cs = 0;
const char* p = input;
const char* pe = p + size;
const char* eof = TSDP_NULL;
if(!input || !size){
TSK_DEBUG_ERROR("Null or empty buffer.");
goto bail;
}
if(!(sdp_msg = TSDP_MESSAGE_CREATE())){
goto bail;
}
/* Ragel init */
/* #line 425 "../src/parsers/tsdp_parser_message.c" */
{
cs = tsdp_machine_message_start;
}
/* #line 254 "tsdp_parser_message.rl" */
/* Ragel execute */
/* #line 434 "../src/parsers/tsdp_parser_message.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 = _tsdp_machine_message_trans_keys + _tsdp_machine_message_key_offsets[cs];
_trans = _tsdp_machine_message_index_offsets[cs];
_klen = _tsdp_machine_message_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 = _tsdp_machine_message_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:
cs = _tsdp_machine_message_trans_targs[_trans];
if ( _tsdp_machine_message_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsdp_machine_message_actions + _tsdp_machine_message_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 56 "tsdp_parser_message.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 63 "tsdp_parser_message.rl" */
{
TSK_DEBUG_INFO("Header A");
}
break;
case 2:
/* #line 67 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_B_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header B");
}
break;
case 3:
/* #line 75 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_C_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header C");
}
break;
case 4:
/* #line 83 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_Dummy_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header Dummy");
}
break;
case 5:
/* #line 91 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_E_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header E");
}
break;
case 6:
/* #line 99 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_I_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header I");
}
break;
case 7:
/* #line 107 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_K_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header K");
}
break;
case 8:
/* #line 115 "tsdp_parser_message.rl" */
{
TSK_DEBUG_INFO("Header M");
}
break;
case 9:
/* #line 119 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_O_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header O");
}
break;
case 10:
/* #line 127 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_P_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header P");
}
break;
case 11:
/* #line 135 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_R_parse(tag_start, (p - tag_start)))){
if(hdr_T){
if(!hdr_T->repeat_fields){
hdr_T->repeat_fields = TSK_LIST_CREATE();
}
tsk_list_push_back_data(hdr_T->repeat_fields, (void**)&header);
}
else{
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
}
TSK_DEBUG_INFO("Header R");
}
break;
case 12:
/* #line 151 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_S_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header S");
}
break;
case 13:
/* #line 159 "tsdp_parser_message.rl" */
{
if((hdr_T = tsdp_header_T_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, TSDP_HEADER(hdr_T));
hdr_T = tsk_object_unref(hdr_T);
}
TSK_DEBUG_INFO("Header T");
}
break;
case 14:
/* #line 167 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_U_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header U");
}
break;
case 15:
/* #line 175 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_V_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header V");
}
break;
case 16:
/* #line 183 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_Z_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header Z");
}
break;
/* #line 673 "../src/parsers/tsdp_parser_message.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
if ( p == eof )
{
const char *__acts = _tsdp_machine_message_actions + _tsdp_machine_message_eof_actions[cs];
unsigned int __nacts = (unsigned int) *__acts++;
while ( __nacts-- > 0 ) {
switch ( *__acts++ ) {
case 1:
/* #line 63 "tsdp_parser_message.rl" */
{
TSK_DEBUG_INFO("Header A");
}
break;
case 2:
/* #line 67 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_B_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header B");
}
break;
case 3:
/* #line 75 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_C_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header C");
}
break;
case 4:
/* #line 83 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_Dummy_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header Dummy");
}
break;
case 5:
/* #line 91 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_E_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header E");
}
break;
case 6:
/* #line 99 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_I_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header I");
}
break;
case 7:
/* #line 107 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_K_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header K");
}
break;
case 8:
/* #line 115 "tsdp_parser_message.rl" */
{
TSK_DEBUG_INFO("Header M");
}
break;
case 9:
/* #line 119 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_O_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header O");
}
break;
case 10:
/* #line 127 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_P_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header P");
}
break;
case 11:
/* #line 135 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_R_parse(tag_start, (p - tag_start)))){
if(hdr_T){
if(!hdr_T->repeat_fields){
hdr_T->repeat_fields = TSK_LIST_CREATE();
}
tsk_list_push_back_data(hdr_T->repeat_fields, (void**)&header);
}
else{
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
}
TSK_DEBUG_INFO("Header R");
}
break;
case 12:
/* #line 151 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_S_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header S");
}
break;
case 13:
/* #line 159 "tsdp_parser_message.rl" */
{
if((hdr_T = tsdp_header_T_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, TSDP_HEADER(hdr_T));
hdr_T = tsk_object_unref(hdr_T);
}
TSK_DEBUG_INFO("Header T");
}
break;
case 14:
/* #line 167 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_U_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header U");
}
break;
case 15:
/* #line 175 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_V_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header V");
}
break;
case 16:
/* #line 183 "tsdp_parser_message.rl" */
{
if((header = (tsdp_header_t*)tsdp_header_Z_parse(tag_start, (p - tag_start)))){
tsdp_message_add_header(sdp_msg, header);
tsk_object_unref(header);
}
TSK_DEBUG_INFO("Header Z");
}
break;
/* #line 849 "../src/parsers/tsdp_parser_message.c" */
}
}
}
_out: {}
}
/* #line 257 "tsdp_parser_message.rl" */
/* Check result */
if( cs <
/* #line 861 "../src/parsers/tsdp_parser_message.c" */
49
/* #line 259 "tsdp_parser_message.rl" */
)
{
TSK_DEBUG_ERROR("Failed to parse SDP message.");
TSK_OBJECT_SAFE_FREE(sdp_msg);
goto bail;
}
bail:
return sdp_msg;
}

29
trunk/tinySDP/src/tsdp.c Normal file
View File

@ -0,0 +1,29 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp.c
* @brief SDP (RFC 4566) implementations with both MMTel and PoC extensions.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tsdp.h"

View File

@ -0,0 +1,202 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsdp_message.c
* @brief SDP message.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinySDP/tsdp_message.h"
/*== Predicate function to find tsdp_header_t object by type. */
static int pred_find_header_by_type(const tsk_list_item_t *item, const void *tsdp_htype)
{
if(item && item->data)
{
tsdp_header_t *header = item->data;
tsdp_header_type_t htype = *((tsdp_header_type_t*)tsdp_htype);
return (header->type - htype);
}
return -1;
}
/*== Predicate function to find tsdp_header_t object by name. */
static int pred_find_header_by_name(const tsk_list_item_t *item, const void *name)
{
if(item && item->data && name)
{
tsdp_header_t *header = item->data;
return tsdp_header_get_nameex(header) - *((const char*)name);
}
return -1;
}
int tsdp_message_add_header(tsdp_message_t *self, const tsdp_header_t *hdr)
{
if(self && hdr)
{
tsdp_header_t *header = tsk_object_ref((void*)hdr);
tsk_list_push_ascending_data(self->headers, (void**)&header); // Very important: Headers MUST appear in a fixed order (see ranks def).
return 0;
}
return -1;
}
int tsdp_message_add_headers(tsdp_message_t *self, const tsdp_headers_L_t *headers)
{
tsk_list_item_t *item = 0;
if(self && headers)
{
tsk_list_foreach(item, headers){
tsdp_message_add_header(self, item->data);
}
return 0;
}
return -1;
}
const tsdp_header_t *tsdp_message_get_headerAt(const tsdp_message_t *self, tsdp_header_type_t type, size_t index)
{
size_t pos = 0;
const tsk_list_item_t *item;
const tsdp_header_t *hdr;
if(!self || !self->headers){
return TSDP_NULL;
}
tsk_list_foreach(item, self->headers)
{
hdr = item->data;
if(hdr->type == type){
if(pos++ >= index){
return hdr;
}
}
}
return TSDP_NULL;
}
const tsdp_header_t *tsdp_message_get_header(const tsdp_message_t *self, tsdp_header_type_t type)
{
return tsdp_message_get_headerAt(self, type, 0);
}
const tsdp_header_t *tsdp_message_get_headerByName(const tsdp_message_t *self, char name)
{
if(self && self->headers){
const tsk_list_item_t* item;
if((item = tsk_list_find_item_by_pred(self->headers, pred_find_header_by_name, &name))){
return item->data;
}
}
return TSDP_NULL;
}
int tsdp_message_tostring(const tsdp_message_t *self, tsk_buffer_t *output)
{
const tsk_list_item_t* item;
if(!self || !output){
return -1;
}
tsk_list_foreach(item, self->headers)
{
if(tsdp_header_tostring(TSDP_HEADER(item->data), output)){
// Abort?
}
}
return 0;
}
//=================================================================================================
// SDP object definition
//
static void* tsdp_message_create(void * self, va_list * app)
{
tsdp_message_t *message = self;
if(message){
message->headers = TSK_LIST_CREATE();
}
return self;
}
static void* tsdp_message_destroy(void * self)
{
tsdp_message_t *message = self;
if(message){
TSK_OBJECT_SAFE_FREE(message->headers);
}
return self;
}
static int tsdp_message_cmp(const void *obj1, const void *obj2)
{
return -1;
}
static const tsk_object_def_t tsdp_message_def_s =
{
sizeof(tsdp_message_t),
tsdp_message_create,
tsdp_message_destroy,
tsdp_message_cmp,
};
const void *tsdp_message_def_t = &tsdp_message_def_s;

View File

@ -0,0 +1,26 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -0,0 +1,41 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TEST_TSDP_STDAFX_H
#define TEST_TSDP_STDAFX_H
#ifdef WIN32
#include "targetver.h"
#endif
#include <stdio.h>
#if (defined(_WIN32) || defined(WIN32) || defined(_WIN32_WCE)) && !defined(__SYMBIAN32__)
#include <tchar.h>
#endif
// TODO: reference additional headers your program requires here
#include <string.h>
#endif /* TEST_TSDP_STDAFX_H */

View File

@ -0,0 +1,14 @@
#ifndef TSDP_TEST_TARGETVER_H
#define TSDP_TEST_TARGETVER_H
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#endif /* TSDP_TEST_TARGETVER_H */

56
trunk/tinySDP/test/test.c Normal file
View File

@ -0,0 +1,56 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "stdafx.h"
#include "tsk.h"
#include "tinySDP/parsers/tsdp_parser_message.h"
#include "test_parser.h"
#define RUN_TEST_LOOP 1
#define RUN_TEST_ALL 0
#define RUN_TEST_PARSER 1
#ifdef _WIN32_WCE
int _tmain(int argc, _TCHAR* argv[])
#else
int main()
#endif
{
#if RUN_TEST_LOOP
for(;;)
#endif
{
/* Print copyright information */
printf("Doubango Project\nCopyright (C) 2009 - 2010 Mamadou Diop \n\n");
#if RUN_TEST_ALL || RUN_TEST_PARSER
test_parser();
#endif
}
}

View File

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="test"
ProjectGUID="{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}"
RootNamespace="test"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\win32\include&quot;;&quot;$(SolutionDir)\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="true"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinySDP.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="true"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\stdafx.c"
>
</File>
<File
RelativePath=".\test.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\targetver.h"
>
</File>
</Filter>
<Filter
Name="tests"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\test_parser.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,75 @@
/*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef _TEST_SDPMESSAGES_H
#define _TEST_SDPMESSAGES_H
#include "tinySDP/headers/tsdp_header_Dummy.h"
#define SDP_MSG1 \
"v=0\r\n" \
"o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" \
"s=\r\n" \
"i=A Seminar on the session description protocol\r\n" \
"u=http://www.example.com/seminars/sdp.pdf\r\n" \
"e=j.doe@example.com (Jane Doe)\r\n" \
"p=+1 617 555-6011\r\n" \
"c=IN IP4 host.atlanta.example.com\r\n" \
"b=X-YZ:128\r\n" \
"z=2882844526 -1h 2898848070 0\r\n" \
"k=base64:ZWFzdXJlLg==\r\n" \
"t=3034423619 3042462419\r\n" \
"r=7d 1h 0 25h\r\n" \
"r=604800 3600 0 90000\r\n" \
"m=audio 49170 RTP/AVP 0 8 97\r\n" \
"a=rtpmap:0 PCMU/8000\r\n" \
"a=rtpmap:8 PCMA/8000\r\n" \
"a=rtpmap:97 iLBC/8000\r\n" \
"m=video 51372 RTP/AVP 31 32\r\n" \
"a=rtpmap:31 H261/90000\r\n" \
"a=rtpmap:32 MPV/90000\r\n"
#define SDP_MSG_TO_TEST SDP_MSG1
void test_parser()
{
tsdp_message_t *message = 0;
/* deserialize the message */
if((message = tsdp_message_parse(SDP_MSG_TO_TEST, strlen(SDP_MSG_TO_TEST)))){
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
/* serialize the message */
tsdp_message_tostring(message, buffer);
TSK_DEBUG_INFO("SDP Message=\n%s", TSK_BUFFER_TO_STRING(buffer));
TSK_OBJECT_SAFE_FREE(buffer);
}
else{
TSK_DEBUG_ERROR("Failed to parse SDP message.");
}
TSK_OBJECT_SAFE_FREE(message);
}
#endif /* _TEST_SDPMESSAGES_H */

44
trunk/tinySDP/tinySDP.sln Normal file
View File

@ -0,0 +1,44 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySDP", "tinySDP.vcproj", "{E45DB518-6562-4033-80E8-60030F0B169F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySAK", "..\tinySAK\tinySAK.vcproj", "{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcproj", "{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
Release|Win32 = Release|Win32
Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.ActiveCfg = Debug|Win32
{E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.Build.0 = Debug|Win32
{E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
{E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.ActiveCfg = Release|Win32
{E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.Build.0 = Release|Win32
{E45DB518-6562-4033-80E8-60030F0B169F}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.ActiveCfg = Debug|Win32
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.Build.0 = Debug|Win32
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.ActiveCfg = Release|Win32
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.Build.0 = Release|Win32
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}.Debug|Win32.ActiveCfg = Debug|Win32
{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}.Debug|Win32.Build.0 = Debug|Win32
{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}.Release|Win32.ActiveCfg = Release|Win32
{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}.Release|Win32.Build.0 = Release|Win32
{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,457 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="tinySDP"
ProjectGUID="{E45DB518-6562-4033-80E8-60030F0B169F}"
RootNamespace="tinySDP"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\win32\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;;&quot;$(DOUBANGO_HOME)\tinySDP\include&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYSDP_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="true"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(OutDir)\tinySAK.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYSDP_EXPORTS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="true"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="source(*.c)"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\tsdp.c"
>
</File>
<File
RelativePath=".\src\tsdp_message.c"
>
</File>
<Filter
Name="headers"
>
<File
RelativePath=".\src\headers\tsdp_header.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_A.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_B.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_C.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_Dummy.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_E.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_I.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_K.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_M.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_O.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_P.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_R.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_S.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_T.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_U.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_V.c"
>
</File>
<File
RelativePath=".\src\headers\tsdp_header_Z.c"
>
</File>
</Filter>
<Filter
Name="parsers"
>
<File
RelativePath=".\src\parsers\tsdp_parser_message.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="include(*.h)"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\include\tinysdp_config.h"
>
</File>
<File
RelativePath=".\include\tsdp.h"
>
</File>
<File
RelativePath=".\include\tinySDP\tsdp_message.h"
>
</File>
<Filter
Name="headers"
>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_A.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_B.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_C.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_Dummy.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_E.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_I.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_K.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_M.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_O.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_P.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_R.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_S.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_T.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_U.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_V.h"
>
</File>
<File
RelativePath=".\include\tinySDP\headers\tsdp_header_Z.h"
>
</File>
</Filter>
<Filter
Name="parsers"
>
<File
RelativePath=".\include\tinySDP\parsers\tsdp_parser_header.h"
>
</File>
<File
RelativePath=".\include\tinySDP\parsers\tsdp_parser_message.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="ragel(*.rl)"
>
<File
RelativePath=".\ragel\tsdp_machine_utils.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_A.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_B.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_C.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_Dummy.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_E.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_I.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_K.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_M.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_O.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_P.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_R.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_S.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_T.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_U.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_V.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_header_Z.rl"
>
</File>
<File
RelativePath=".\ragel\tsdp_parser_message.rl"
>
</File>
</Filter>
<Filter
Name="abnf(*.abnf)"
>
<File
RelativePath=".\abnf\sdp.abnf"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>