Update Android support.
This commit is contained in:
parent
519f921fa9
commit
788da34e1d
|
@ -47,6 +47,9 @@ THTTP_BEGIN_DECLS
|
|||
#define THTTP_HEADER(self) ((thttp_header_t*)(self))
|
||||
#define THTTP_HEADER_PARAMS(self) (THTTP_HEADER(self)->params)
|
||||
|
||||
// FD
|
||||
struct thttp_header_s;
|
||||
|
||||
typedef int (*thttp_header_value_tostring)(const struct thttp_header_s* header, tsk_buffer_t* output);
|
||||
|
||||
/**
|
||||
|
|
|
@ -164,43 +164,43 @@ thttp_message_t;
|
|||
typedef thttp_message_t thttp_request_t; /**< HTTP request message. */
|
||||
typedef thttp_message_t thttp_response_t; /**< HTTP response message. */
|
||||
|
||||
|
||||
//
|
||||
TINYHTTP_API int thttp_message_add_header(thttp_message_t *self, const thttp_header_t *hdr);
|
||||
TINYHTTP_API int thttp_message_add_headers(thttp_message_t *self, const thttp_headers_L_t *headers);
|
||||
|
||||
#if !defined(_MSC_VER) || defined(__GNUC__)
|
||||
static void THTTP_MESSAGE_ADD_HEADER(thttp_message_t *self, ...)
|
||||
{
|
||||
va_list ap;
|
||||
thttp_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);
|
||||
|
||||
thttp_message_add_header(self, header);
|
||||
tsk_object_unref(header);
|
||||
}
|
||||
#else
|
||||
#define THTTP_MESSAGE_ADD_HEADER(self, objdef, ...) \
|
||||
{ \
|
||||
thttp_header_t *header = tsk_object_new(objdef, __VA_ARGS__); \
|
||||
thttp_message_add_header(self, header); \
|
||||
tsk_object_unref(header); \
|
||||
}
|
||||
#endif
|
||||
|
||||
TINYHTTP_API const thttp_header_t *thttp_message_get_headerAt(const thttp_message_t *self, thttp_header_type_t type, size_t index);
|
||||
TINYHTTP_API const thttp_header_t *thttp_message_get_header(const thttp_message_t *self, thttp_header_type_t type);
|
||||
|
||||
//TINYHTTP_API int thttp_message_add_headers(thttp_message_t *self, const thttp_headers_L_t *headers);
|
||||
//
|
||||
//#if !defined(_MSC_VER) || defined(__GNUC__)
|
||||
//static void THTTP_MESSAGE_ADD_HEADER(thttp_message_t *self, ...)
|
||||
// {
|
||||
// va_list ap;
|
||||
// thttp_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);
|
||||
//
|
||||
// thttp_message_add_header(self, header);
|
||||
// tsk_object_unref(header);
|
||||
// }
|
||||
//#else
|
||||
//#define THTTP_MESSAGE_ADD_HEADER(self, objdef, ...) \
|
||||
// { \
|
||||
// thttp_header_t *header = tsk_object_new(objdef, __VA_ARGS__); \
|
||||
// thttp_message_add_header(self, header); \
|
||||
// tsk_object_unref(header); \
|
||||
// }
|
||||
//#endif
|
||||
//
|
||||
//TINYHTTP_API const thttp_header_t *thttp_message_get_headerAt(const thttp_message_t *self, thttp_header_type_t type, size_t index);
|
||||
//TINYHTTP_API const thttp_header_t *thttp_message_get_header(const thttp_message_t *self, thttp_header_type_t type);
|
||||
//
|
||||
TINYHTTP_API uint32_t thttp_message_getContent_length(const thttp_message_t *message);
|
||||
|
||||
TINYHTTP_API int thttp_message_tostring(const thttp_message_t *self, tsk_buffer_t *output);
|
||||
|
||||
TINYHTTP_API thttp_request_t *thttp_request_new(const char* method, const thttp_url_t *request_url, const thttp_url_t *from, const thttp_url_t *to, const char *call_id, int32_t cseq);
|
||||
TINYHTTP_API thttp_response_t *thttp_response_new(short status_code, const char* reason_phrase, const thttp_request_t *request);
|
||||
//
|
||||
//TINYHTTP_API int thttp_message_tostring(const thttp_message_t *self, tsk_buffer_t *output);
|
||||
//
|
||||
//TINYHTTP_API thttp_request_t *thttp_request_new(const char* method, const thttp_url_t *request_url, const thttp_url_t *from, const thttp_url_t *to, const char *call_id, int32_t cseq);
|
||||
//TINYHTTP_API thttp_response_t *thttp_response_new(short status_code, const char* reason_phrase, const thttp_request_t *request);
|
||||
|
||||
TINYHTTP_GEXTERN const void *thttp_message_def_t;
|
||||
|
||||
|
|
|
@ -258,4 +258,4 @@ int thttp_auth_digest_response(const tsk_md5string_t *ha1, const char* nonce, co
|
|||
TSK_FREE(res);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9765,4 +9765,4 @@ static const tsk_object_def_t thttp_header_Authorization_def_s =
|
|||
thttp_header_Authorization_destroy,
|
||||
0
|
||||
};
|
||||
const void *thttp_header_Authorization_def_t = &thttp_header_Authorization_def_s;
|
||||
const void *thttp_header_Authorization_def_t = &thttp_header_Authorization_def_s;
|
||||
|
|
|
@ -6494,4 +6494,4 @@ static const tsk_object_def_t thttp_header_WWW_Authenticate_def_s =
|
|||
thttp_header_WWW_Authenticate_destroy,
|
||||
0
|
||||
};
|
||||
const void *thttp_header_WWW_Authenticate_def_t = &thttp_header_WWW_Authenticate_def_s;
|
||||
const void *thttp_header_WWW_Authenticate_def_t = &thttp_header_WWW_Authenticate_def_s;
|
||||
|
|
|
@ -10,7 +10,7 @@ all: $(APP)
|
|||
OBJS = \
|
||||
thttp.o\
|
||||
thttp_message.o\
|
||||
thttp_utl.o
|
||||
thttp_url.o
|
||||
###################
|
||||
## auth
|
||||
###################
|
||||
|
@ -18,7 +18,17 @@ OBJS += auth/thttp_auth.o
|
|||
###################
|
||||
## headers
|
||||
###################
|
||||
|
||||
OBJS += headers/thttp_header.o\
|
||||
headers/thttp_header_Authorization.o\
|
||||
headers/thttp_header_Proxy_Authenticate.o\
|
||||
headers/thttp_header_WWW_Authenticate.o
|
||||
###################
|
||||
## parsers
|
||||
###################
|
||||
OBJS += parsers/thttp_parser_header.o\
|
||||
parsers/thttp_parser_message.o\
|
||||
parsers/thttp_parser_url.o
|
||||
|
||||
$(APP): $(OBJS)
|
||||
$(CPP) $(LDFLAGS) -o $@ $^
|
||||
|
||||
|
|
|
@ -2266,4 +2266,4 @@ _again:
|
|||
533
|
||||
/* #line 321 "thttp_parser_header.rl" */
|
||||
) ? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -485,4 +485,4 @@ static void thttp_message_parser_eoh(tsk_ragel_state_t *state, thttp_message_t *
|
|||
state->p = p;
|
||||
state->pe = pe;
|
||||
state->eof = eof;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,4 +274,4 @@ _again:
|
|||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 thttp_message.c
|
||||
* @brief Represents a HTTP message. A HTTP message is either a request from a client to a server, or a
|
||||
* response from a server to a client.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinyHTTP/thttp_message.h"
|
||||
|
||||
|
||||
int thttp_message_add_header(thttp_message_t *self, const thttp_header_t *hdr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t thttp_message_getContent_length(const thttp_message_t *message)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// THTTP mesage object definition
|
||||
//
|
||||
static void* thttp_message_create(void * self, va_list * app)
|
||||
{
|
||||
thttp_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* thttp_message_destroy(void * self)
|
||||
{
|
||||
thttp_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static int thttp_message_cmp(const void *obj1, const void *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t thttp_message_def_s =
|
||||
{
|
||||
sizeof(thttp_message_t),
|
||||
thttp_message_create,
|
||||
thttp_message_destroy,
|
||||
thttp_message_cmp,
|
||||
};
|
||||
const void *thttp_message_def_t = &thttp_message_def_s;
|
|
@ -51,6 +51,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
|
@ -166,7 +167,7 @@
|
|||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RemoteDirectory="%CSIDL_PROGRAM_FILES%\test"
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
*
|
||||
* @brief poll() method implementation for multiplexing network sockets.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop /
|
||||
*
|
||||
* @param fds An array of pollfd structures.
|
||||
* @param nfds The number of file descriptors set in fds[ ].
|
||||
* @param timeout How long poll() should wait for an event to occur (in milliseconds).
|
||||
|
|
|
@ -162,7 +162,11 @@ static void* tnet_socket_create(void * self, va_list * app)
|
|||
hints.ai_family = TNET_SOCKET_TYPE_IS_IPV6(sock->type) ? AF_INET6 : AF_INET;
|
||||
hints.ai_socktype = TNET_SOCKET_TYPE_IS_STREAM(sock->type) ? SOCK_STREAM : SOCK_DGRAM;
|
||||
hints.ai_protocol = TNET_SOCKET_TYPE_IS_STREAM(sock->type) ? IPPROTO_TCP : IPPROTO_UDP;
|
||||
hints.ai_flags = AI_PASSIVE /*| AI_ADDRCONFIG*/; /* Bind to the local machine. */
|
||||
hints.ai_flags = AI_PASSIVE
|
||||
#if !TNET_UNDER_WINDOWS
|
||||
| AI_ADDRCONFIG
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Performs getaddrinfo */
|
||||
if((status = tnet_getaddrinfo(local_hostname, port, &hints, &result)))
|
||||
|
@ -177,31 +181,22 @@ static void* tnet_socket_create(void * self, va_list * app)
|
|||
//if(ptr->ai_family == hints.ai_family && ptr->ai_socktype == hints.ai_socktype && ptr->ai_protocol == hints.ai_protocol)
|
||||
{
|
||||
sock->fd = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
|
||||
/* Get local IP string. */
|
||||
if((status = tnet_getnameinfo(ptr->ai_addr, ptr->ai_addrlen, sock->ip, sizeof(sock->ip), 0, 0, NI_NUMERICHOST)))
|
||||
|
||||
/* Bind the socket */
|
||||
if((status = bind(sock->fd, ptr->ai_addr, ptr->ai_addrlen)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR("getnameinfo have failed");
|
||||
TNET_PRINT_LAST_ERROR("bind have failed.");
|
||||
tnet_socket_close(sock);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
||||
/* Get local IP string. */
|
||||
if(status = tnet_get_ip_n_port(sock->fd , &sock->ip, &sock->port)) /* % */
|
||||
//if((status = tnet_getnameinfo(ptr->ai_addr, ptr->ai_addrlen, sock->ip, sizeof(sock->ip), 0, 0, NI_NUMERICHOST)))
|
||||
{
|
||||
if((status = bind(sock->fd, ptr->ai_addr, ptr->ai_addrlen)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR("bind have failed.");
|
||||
tnet_socket_close(sock);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sock->port == TNET_SOCKET_PORT_ANY && (status = tnet_get_port(sock->fd, &(sock->port))))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR("Failed to retrieve IP and Port.");
|
||||
tnet_socket_close(sock);
|
||||
continue;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
TNET_PRINT_LAST_ERROR("Failed to get local IP and port.");
|
||||
tnet_socket_close(sock);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ typedef struct transport_context_s
|
|||
size_t count;
|
||||
short events;
|
||||
tnet_fd_t pipeW;
|
||||
tnet_fd_t pipeR;
|
||||
tnet_pollfd_t ufds[TNET_MAX_FDS];
|
||||
transport_socket_t* sockets[TNET_MAX_FDS];
|
||||
}
|
||||
|
@ -108,7 +109,8 @@ int tnet_transport_add_socket(const tnet_transport_handle_t *handle, tnet_fd_t f
|
|||
transport_socket_add(fd, context);
|
||||
|
||||
// signal
|
||||
return (write(context->pipeW, &c, 1) > 0);
|
||||
ret = write(context->pipeW, &c, 1);
|
||||
return (ret > 0 ? 0 : ret);
|
||||
}
|
||||
|
||||
// ...
|
||||
|
@ -357,7 +359,7 @@ void *tnet_transport_mainthread(void *param)
|
|||
transport_socket_t* active_socket;
|
||||
|
||||
context = (transport_context_t*)tsk_calloc(1, sizeof(transport_context_t));
|
||||
context->events = TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? TNET_POLLIN : TNET_POLLIN | TNET_POLLOUT | TNET_POLLPRI;
|
||||
context->events = TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? TNET_POLLIN : TNET_POLLIN /*| TNET_POLLOUT*/ | TNET_POLLPRI;
|
||||
transport->context = context;
|
||||
|
||||
/* Start listening */
|
||||
|
@ -376,9 +378,12 @@ void *tnet_transport_mainthread(void *param)
|
|||
TNET_PRINT_LAST_ERROR("Failed to create new pipes.");
|
||||
goto bail;
|
||||
}
|
||||
transport_socket_add(pipes[0], context); // Add pipeR
|
||||
|
||||
context->pipeR = pipes[0];
|
||||
context->pipeW = pipes[1];
|
||||
|
||||
transport_socket_add(context->pipeR, context);
|
||||
|
||||
/* Add the current transport socket to the context. */
|
||||
transport_socket_add(transport->master->fd, context);
|
||||
|
||||
|
@ -406,7 +411,9 @@ void *tnet_transport_mainthread(void *param)
|
|||
*/
|
||||
for(i=0; i<context->count; i++)
|
||||
{
|
||||
if(!context->ufds[i].revents) continue;
|
||||
if(!context->ufds[i].revents || context->ufds[i].fd == context->pipeR){
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Get active event and socket */
|
||||
active_socket = context->sockets[i];
|
||||
|
@ -436,7 +443,7 @@ void *tnet_transport_mainthread(void *param)
|
|||
}
|
||||
|
||||
/* Receive the waiting data. */
|
||||
if(recv(active_socket->fd, buffer, len, 0) < 0)
|
||||
if((ret = recv(active_socket->fd, buffer, len, 0)) < 0)
|
||||
{
|
||||
TSK_FREE(buffer);
|
||||
//if(tnet_geterrno() == TNET_ERROR_WOULDBLOCK)
|
||||
|
|
|
@ -70,8 +70,8 @@ void tnet_getlasterror(tnet_error_t *error)
|
|||
0);
|
||||
}
|
||||
#else
|
||||
//FIXME: use strerror(errno);
|
||||
sprintf(*error, "Network error (%d).", err);
|
||||
strerror_r(err, *error, sizeof(*error));
|
||||
//sprintf(*error, "Network error (%d).", err);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,7 @@ tnet_interfaces_L_t* tnet_get_interfaces()
|
|||
TSK_DEBUG_ERROR("Error allocating memory needed to call GetAdaptersinfo.");
|
||||
goto bail;
|
||||
}
|
||||
// Make an initial call to GetAdaptersInfo to get
|
||||
// the necessary size into the ulOutBufLen variable
|
||||
// Make an initial call to GetAdaptersInfo to get the necessary size into the ulOutBufLen variable
|
||||
if (GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
FREE(pAdapterInfo);
|
||||
|
@ -135,7 +134,13 @@ tnet_interfaces_L_t* tnet_get_interfaces()
|
|||
pAdapter = pAdapterInfo;
|
||||
while(pAdapter)
|
||||
{
|
||||
tnet_interface_t *iface = TNET_INTERFACE_CREATE(pAdapter->Description, pAdapter->Address, pAdapter->AddressLength);
|
||||
tnet_interface_t *iface;
|
||||
|
||||
if(pAdapter->Type == MIB_IF_TYPE_LOOPBACK){
|
||||
continue;
|
||||
}
|
||||
|
||||
iface = TNET_INTERFACE_CREATE(pAdapter->Description, pAdapter->Address, pAdapter->AddressLength);
|
||||
iface->index = pAdapter->Index;
|
||||
tsk_list_push_back_data(ifaces, &(iface));
|
||||
|
||||
|
@ -264,7 +269,7 @@ bail:
|
|||
return ifaces;
|
||||
}
|
||||
|
||||
tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, unsigned anycast, unsigned multicast, unsigned dnsserver)
|
||||
tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, unsigned anycast, unsigned multicast, unsigned dnsserver, long if_index)
|
||||
{
|
||||
tnet_addresses_L_t *addresses = TSK_LIST_CREATE();
|
||||
tnet_ip_t ip;
|
||||
|
@ -320,12 +325,16 @@ tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, u
|
|||
pCurrAddresses = pAddresses;
|
||||
while (pCurrAddresses)
|
||||
{
|
||||
if((if_index != -1) && (pCurrAddresses->IfIndex != if_index && pCurrAddresses->Ipv6IfIndex != if_index)){
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* UNICAST addresses
|
||||
*/
|
||||
pUnicast = pCurrAddresses->FirstUnicastAddress;
|
||||
while(unicast && pUnicast)
|
||||
{
|
||||
memset(ip, '\0', sizeof(ip));
|
||||
//memset(ip, '\0', sizeof(ip));
|
||||
tnet_get_sockip(pUnicast->Address.lpSockaddr, &ip);
|
||||
{
|
||||
tnet_address_t *address = TNET_ADDRESS_CREATE(ip);
|
||||
|
@ -342,7 +351,7 @@ tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, u
|
|||
pAnycast = pCurrAddresses->FirstAnycastAddress;
|
||||
while(anycast && pAnycast)
|
||||
{
|
||||
memset(ip, '\0', sizeof(ip));
|
||||
//memset(ip, '\0', sizeof(ip));
|
||||
tnet_get_sockip(pAnycast->Address.lpSockaddr, &ip);
|
||||
{
|
||||
tnet_address_t *address = TNET_ADDRESS_CREATE(ip);
|
||||
|
@ -359,7 +368,7 @@ tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, u
|
|||
pMulticast = pCurrAddresses->FirstMulticastAddress;
|
||||
while(multicast && pMulticast)
|
||||
{
|
||||
memset(ip, '\0', sizeof(ip));
|
||||
//memset(ip, '\0', sizeof(ip));
|
||||
tnet_get_sockip(pMulticast->Address.lpSockaddr, &ip);
|
||||
{
|
||||
tnet_address_t *address = TNET_ADDRESS_CREATE(ip);
|
||||
|
@ -376,7 +385,7 @@ tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, u
|
|||
pDnServer = pCurrAddresses->FirstDnsServerAddress;
|
||||
while(dnsserver && pDnServer)
|
||||
{
|
||||
memset(ip, '\0', sizeof(ip));
|
||||
//memset(ip, '\0', sizeof(ip));
|
||||
tnet_get_sockip(pDnServer->Address.lpSockaddr, &ip);
|
||||
{
|
||||
tnet_address_t *address = TNET_ADDRESS_CREATE(ip);
|
||||
|
@ -387,7 +396,7 @@ tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, u
|
|||
|
||||
pDnServer = pDnServer->Next;
|
||||
}
|
||||
|
||||
next:
|
||||
pCurrAddresses = pCurrAddresses->Next;
|
||||
}
|
||||
}
|
||||
|
@ -415,6 +424,56 @@ bail:
|
|||
return addresses;
|
||||
}
|
||||
|
||||
|
||||
int tnet_getbestsource(const char* destination, tnet_socket_type_t type, tnet_ip_t *source)
|
||||
{
|
||||
int ret = -1;
|
||||
struct sockaddr_storage destAddr;
|
||||
tnet_addresses_L_t* addresses = 0;
|
||||
const tsk_list_item_t* item;
|
||||
#if TNET_UNDER_WINDOWS
|
||||
DWORD dwBestIfIndex;
|
||||
#endif
|
||||
|
||||
if(!destination || !source){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if((ret = tnet_sockaddr_init(destination, 0, type, &destAddr))){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
if(GetBestInterfaceEx((struct sockaddr*)&destAddr, &dwBestIfIndex) != NO_ERROR){
|
||||
ret = WSAGetLastError();
|
||||
TNET_PRINT_LAST_ERROR("GetBestInterfaceEx failed.");
|
||||
goto bail;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!(addresses = tnet_get_addresses(TNET_SOCKET_TYPE_IS_IPV6(type) ? AF_INET6 : AF_INET, 1, 0, 0, 0, dwBestIfIndex))){
|
||||
ret = -2;
|
||||
TSK_DEBUG_ERROR("Failed to retrieve addresses.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
tsk_list_foreach(item, addresses)
|
||||
{
|
||||
const tnet_address_t* address = item->data;
|
||||
if(address && address->ip){
|
||||
memset(*source, '\0', sizeof(*source));
|
||||
memcpy(*source, address->ip, strlen(address->ip) > sizeof(*source) ? sizeof(*source) : strlen(address->ip));
|
||||
ret = 0;
|
||||
goto bail; // First is good for us.
|
||||
}
|
||||
}
|
||||
|
||||
bail:
|
||||
TSK_OBJECT_SAFE_FREE(addresses);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @fn int tnet_getaddrinfo(const char *node, const char *service,
|
||||
* const struct addrinfo *hints, struct addrinfo **res)
|
||||
|
@ -512,6 +571,9 @@ int tnet_get_sockip_n_port(struct sockaddr *addr, tnet_ip_t *ip, tnet_port_t *po
|
|||
else if(addr->sa_family == AF_INET6)
|
||||
{
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr;
|
||||
#if TNET_UNDER_WINDOWS
|
||||
int index;
|
||||
#endif
|
||||
if(port)
|
||||
{
|
||||
*port = ntohs(sin6->sin6_port);
|
||||
|
@ -523,6 +585,12 @@ int tnet_get_sockip_n_port(struct sockaddr *addr, tnet_ip_t *ip, tnet_port_t *po
|
|||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
if((index = tsk_strindexOf(*ip, strlen(*ip), "%")) > 0){
|
||||
*(*ip + index) = '\0';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -536,7 +604,9 @@ int tnet_get_sockip_n_port(struct sockaddr *addr, tnet_ip_t *ip, tnet_port_t *po
|
|||
|
||||
int tnet_get_ip_n_port(tnet_fd_t fd, tnet_ip_t *ip, tnet_port_t *port)
|
||||
{
|
||||
*port = 0;
|
||||
if(port){
|
||||
*port = 0;
|
||||
}
|
||||
|
||||
if(fd > 0)
|
||||
{
|
||||
|
|
|
@ -75,21 +75,22 @@ TINYNET_API void tnet_getlasterror(tnet_error_t *error);
|
|||
TINYNET_API int tnet_geterrno();
|
||||
|
||||
TINYNET_API tnet_interfaces_L_t* tnet_get_interfaces();
|
||||
TINYNET_API tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, unsigned anycast, unsigned multicast, unsigned dnsserver);
|
||||
#define tnet_get_addresses_all() tnet_get_addresses(AF_UNSPEC, 1, 1, 1, 1)
|
||||
#define tnet_get_addresses_all_unicast() tnet_get_addresses(AF_UNSPEC, 1, 0, 0, 0)
|
||||
#define tnet_get_addresses_unicast4() tnet_get_addresses(AF_INET, 1, 0, 0, 0)
|
||||
#define tnet_get_addresses_unicast6() tnet_get_addresses(AF_INET6, 1, 0, 0, 0)
|
||||
#define tnet_get_addresses_all_anycast() tnet_get_addresses(AF_UNSPEC, 0, 1, 0, 0)
|
||||
#define tnet_get_addresses_anycast4() tnet_get_addresses(AF_INET, 0, 1, 0, 0)
|
||||
#define tnet_get_addresses_anycast6() tnet_get_addresses(AF_INET6, 0, 1, 0, 0)
|
||||
#define tnet_get_addresses_all_multicast() tnet_get_addresses(AF_UNSPEC, 0, 0, 1, 0)
|
||||
#define tnet_get_addresses_multicast4() tnet_get_addresses(AF_INET, 0, 0, 1, 0)
|
||||
#define tnet_get_addresses_multicast6() tnet_get_addresses(AF_INET6, 0, 0, 1, 0)
|
||||
#define tnet_get_addresses_all_dnsservers() tnet_get_addresses(AF_UNSPEC, 0, 0, 0, 1)
|
||||
#define tnet_get_addresses_dnsservers4() tnet_get_addresses(AF_INET, 0, 0, 0, 1)
|
||||
#define tnet_get_addresses_dnsservers6() tnet_get_addresses(AF_INET6, 0, 0, 0, 1)
|
||||
TINYNET_API tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, unsigned unicast, unsigned anycast, unsigned multicast, unsigned dnsserver, long if_index);
|
||||
#define tnet_get_addresses_all() tnet_get_addresses(AF_UNSPEC, 1, 1, 1, 1, -1)
|
||||
#define tnet_get_addresses_all_unicast() tnet_get_addresses(AF_UNSPEC, 1, 0, 0, 0, -1)
|
||||
#define tnet_get_addresses_unicast4() tnet_get_addresses(AF_INET, 1, 0, 0, 0, -1)
|
||||
#define tnet_get_addresses_unicast6() tnet_get_addresses(AF_INET6, 1, 0, 0, 0, -1)
|
||||
#define tnet_get_addresses_all_anycast() tnet_get_addresses(AF_UNSPEC, 0, 1, 0, 0, -1)
|
||||
#define tnet_get_addresses_anycast4() tnet_get_addresses(AF_INET, 0, 1, 0, 0, -1)
|
||||
#define tnet_get_addresses_anycast6() tnet_get_addresses(AF_INET6, 0, 1, 0, 0, -1)
|
||||
#define tnet_get_addresses_all_multicast() tnet_get_addresses(AF_UNSPEC, 0, 0, 1, 0, -1)
|
||||
#define tnet_get_addresses_multicast4() tnet_get_addresses(AF_INET, 0, 0, 1, 0, -1)
|
||||
#define tnet_get_addresses_multicast6() tnet_get_addresses(AF_INET6, 0, 0, 1, 0, -1)
|
||||
#define tnet_get_addresses_all_dnsservers() tnet_get_addresses(AF_UNSPEC, 0, 0, 0, 1, -1)
|
||||
#define tnet_get_addresses_dnsservers4() tnet_get_addresses(AF_INET, 0, 0, 0, 1, -1)
|
||||
#define tnet_get_addresses_dnsservers6() tnet_get_addresses(AF_INET6, 0, 0, 0, 1, -1)
|
||||
|
||||
TINYNET_API int tnet_getbestsource(const char* destination, tnet_socket_type_t type, tnet_ip_t *source);
|
||||
TINYNET_API int tnet_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
|
||||
TINYNET_API void tnet_freeaddrinfo(struct addrinfo *ai);
|
||||
TINYNET_API int tnet_get_sockaddr(tnet_fd_t fd, struct sockaddr_storage *result);
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
#define RUN_TEST_AUTH 0
|
||||
#define RUN_TEST_STUN 0
|
||||
#define RUN_TEST_NAT 0
|
||||
#define RUN_TEST_IFACES 0
|
||||
#define RUN_TEST_IFACES 1
|
||||
#define RUN_TEST_DNS 0
|
||||
#define RUN_TEST_DHCP 1
|
||||
#define RUN_TEST_DHCP 0
|
||||
#define RUN_TEST_DHCP6 0
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
|
|
@ -22,6 +22,25 @@
|
|||
#ifndef TNET_TEST_IFACES_H
|
||||
#define TNET_TEST_IFACES_H
|
||||
|
||||
void test_faces_bestsource()
|
||||
{
|
||||
tnet_ip_t source;
|
||||
// IPv6
|
||||
if(!tnet_getbestsource("2a01:e35:8b32:7050:212:f0ff:fe4c:3ea1", tnet_socket_type_udp_ipv6, &source)){
|
||||
TSK_DEBUG_INFO("Best IPv6 source is [%s]", source);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to get best IPv6 source.");
|
||||
}
|
||||
// IPv4
|
||||
if(!tnet_getbestsource("192.168.0.11", tnet_socket_type_udp_ipv4, &source)){
|
||||
TSK_DEBUG_INFO("Best IPv4 source is [%s]", source);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to get best IPv4 source.");
|
||||
}
|
||||
}
|
||||
|
||||
void test_ifaces_dump_ifaces()
|
||||
{
|
||||
tnet_interfaces_L_t* ifaces = tnet_get_interfaces();
|
||||
|
@ -67,6 +86,7 @@ void test_ifaces_dump_addresses()
|
|||
|
||||
void test_ifaces()
|
||||
{
|
||||
test_faces_bestsource();
|
||||
test_ifaces_dump_ifaces();
|
||||
test_ifaces_dump_addresses();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ OBJS = tsk.o\
|
|||
tsk_buffer.o\
|
||||
tsk_condwait.o\
|
||||
tsk_debug.o\
|
||||
tsk_fsm.o\
|
||||
tsk_heap.o\
|
||||
tsk_hmac.o\
|
||||
tsk_list.o\
|
||||
|
@ -23,6 +24,7 @@ OBJS = tsk.o\
|
|||
tsk_params.o\
|
||||
tsk_ppfcs16.o\
|
||||
tsk_ppfcs32.o\
|
||||
tsk_ragel_state.o\
|
||||
tsk_runnable.o\
|
||||
tsk_safeobj.o\
|
||||
tsk_semaphore.o\
|
||||
|
|
|
@ -245,4 +245,4 @@ static const tsk_object_def_t tsk_fsm_entry_def_s =
|
|||
tsk_fsm_entry_destroy,
|
||||
tsk_fsm_entry_cmp,
|
||||
};
|
||||
const void *tsk_fsm_entry_def_t = &tsk_fsm_entry_def_s;
|
||||
const void *tsk_fsm_entry_def_t = &tsk_fsm_entry_def_s;
|
||||
|
|
|
@ -99,19 +99,19 @@ void* tsk_object_new2(const tsk_object_def_t *objdef, va_list* ap)
|
|||
|
||||
size_t tsk_object_sizeof(const void *self)
|
||||
{
|
||||
const tsk_object_def_t **objdef = self;
|
||||
const tsk_object_def_t **objdef = (const tsk_object_def_t **)self;
|
||||
if(objdef && *objdef){
|
||||
return (*objdef)->size;
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("NULL tsk obkect.");
|
||||
TSK_DEBUG_ERROR("NULL object definition.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int tsk_object_cmp(const void *self, const void *object)
|
||||
{
|
||||
const tsk_object_def_t **objdef = self;
|
||||
const tsk_object_def_t **objdef = (const tsk_object_def_t **)self;
|
||||
|
||||
if(objdef && *objdef && (*objdef)->objcmp){
|
||||
return (*objdef)->objcmp(self, object);
|
||||
|
|
|
@ -80,7 +80,7 @@ TSK_BEGIN_DECLS
|
|||
{ \
|
||||
char* tmp = tsk_calloc(len+1, sizeof(char)); \
|
||||
memcpy(tmp, tag_start, len); \
|
||||
retval = (##type)##func(tmp); \
|
||||
retval = (type) func(tmp); \
|
||||
free(tmp); \
|
||||
} \
|
||||
}
|
||||
|
|
|
@ -78,4 +78,4 @@ int tsk_uuidgenerate(tsk_uuidstring_t *result)
|
|||
(*result)[36] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
TSIP_BEGIN_DECLS
|
||||
|
||||
//FD
|
||||
struct tsip_message_s;
|
||||
|
||||
#define TSIP_OPERATION_CREATE(stack, ...) tsk_object_new(tsip_operation_def_t, stack, __VA_ARGS__)
|
||||
|
||||
typedef uint64_t tsip_operation_id_t;
|
||||
|
|
|
@ -5,7 +5,7 @@ export OPTIONS="-C -L -T0"
|
|||
#export OPTIONS="-C -L -G2"
|
||||
|
||||
# SIP/SIPS/TEL URI parser
|
||||
#ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_uri.c tsip_parser_uri.rl
|
||||
ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_uri.c tsip_parser_uri.rl
|
||||
|
||||
# SIP message (both requests an responses) parser.
|
||||
ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_message.c tsip_parser_message.rl
|
||||
|
@ -15,106 +15,106 @@ ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_header.c tsip_parser_header.rl
|
|||
|
||||
|
||||
# ==Allow
|
||||
##ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl
|
||||
|
||||
# ==Allow-Events
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow_Events.c tsip_parser_header_Allow_Events.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow_Events.c tsip_parser_header_Allow_Events.rl
|
||||
|
||||
# ==Authorization
|
||||
#######ragel.exe $OPTIONS -o ../src/headers/tsip_header_Authorization.c tsip_parser_header_Authorization.rl
|
||||
######ragel.exe $OPTIONS -o ../src/headers/tsip_header_Authorization.c tsip_parser_header_Authorization.rl
|
||||
|
||||
# ==Call-ID
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Call_ID.c tsip_parser_header_Call_ID.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Call_ID.c tsip_parser_header_Call_ID.rl
|
||||
|
||||
# ==Content-Length
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl
|
||||
|
||||
# ==Content-Type
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Type.c tsip_parser_header_Content_Type.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Type.c tsip_parser_header_Content_Type.rl
|
||||
|
||||
# ==Contact
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Contact.c tsip_parser_header_Contact.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Contact.c tsip_parser_header_Contact.rl
|
||||
|
||||
# ==CSeq
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_CSeq.c tsip_parser_header_CSeq.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_CSeq.c tsip_parser_header_CSeq.rl
|
||||
|
||||
# ==Event
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Event.c tsip_parser_header_Event.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Event.c tsip_parser_header_Event.rl
|
||||
|
||||
# ==Expires
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Expires.c tsip_parser_header_Expires.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Expires.c tsip_parser_header_Expires.rl
|
||||
|
||||
# ==From
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_From.c tsip_parser_header_From.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_From.c tsip_parser_header_From.rl
|
||||
|
||||
# ==Max-Forwards
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Max_Forwards.c tsip_parser_header_Max_Forwards.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Max_Forwards.c tsip_parser_header_Max_Forwards.rl
|
||||
|
||||
# ==Min-Expires
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Min_Expires.c tsip_parser_header_Min_Expires.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Min_Expires.c tsip_parser_header_Min_Expires.rl
|
||||
|
||||
# ==Path
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Path.c tsip_parser_header_Path.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Path.c tsip_parser_header_Path.rl
|
||||
|
||||
# ==P-Access-Network-Info
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Access_Network_Info.c tsip_parser_header_P_Access_Network_Info.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Access_Network_Info.c tsip_parser_header_P_Access_Network_Info.rl
|
||||
|
||||
# ==P-Asserted-Identity
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Asserted_Identity.c tsip_parser_header_P_Asserted_Identity.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Asserted_Identity.c tsip_parser_header_P_Asserted_Identity.rl
|
||||
|
||||
# ==P-Associated-URI
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Associated_URI.c tsip_parser_header_P_Associated_URI.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Associated_URI.c tsip_parser_header_P_Associated_URI.rl
|
||||
|
||||
# ==P-Charging-Function-Addresses
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Charging_Function_Addresses.c tsip_parser_header_P_Charging_Function_Addresses.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Charging_Function_Addresses.c tsip_parser_header_P_Charging_Function_Addresses.rl
|
||||
|
||||
# ==P-Preferred-Identity
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Preferred_Identity.c tsip_parser_header_P_Preferred_Identity.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Preferred_Identity.c tsip_parser_header_P_Preferred_Identity.rl
|
||||
|
||||
# ==Privacy
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Privacy.c tsip_parser_header_Privacy.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Privacy.c tsip_parser_header_Privacy.rl
|
||||
|
||||
# ==Proxy-Authenticate
|
||||
#########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authenticate.c tsip_parser_header_Proxy_Authenticate.rl
|
||||
########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authenticate.c tsip_parser_header_Proxy_Authenticate.rl
|
||||
|
||||
# ==Proxy-Authorization
|
||||
##########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authorization.c tsip_parser_header_Proxy_Authorization.rl
|
||||
#########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authorization.c tsip_parser_header_Proxy_Authorization.rl
|
||||
|
||||
# ==Record-Route
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Record_Route.c tsip_parser_header_Record_Route.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Record_Route.c tsip_parser_header_Record_Route.rl
|
||||
|
||||
# ==Require
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Require.c tsip_parser_header_Require.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Require.c tsip_parser_header_Require.rl
|
||||
|
||||
# == Server
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Server.c tsip_parser_header_Server.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Server.c tsip_parser_header_Server.rl
|
||||
|
||||
# == Route
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Route.c tsip_parser_header_Route.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Route.c tsip_parser_header_Route.rl
|
||||
|
||||
# == Security-Client
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Security_Client.c tsip_parser_header_Security_Client.rl
|
||||
|
||||
# == Service-Route
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Service_Route.c tsip_parser_header_Service_Route.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Service_Route.c tsip_parser_header_Service_Route.rl
|
||||
|
||||
# ==Subscription-State
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Subscription_State.c tsip_parser_header_Subscription_State.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Subscription_State.c tsip_parser_header_Subscription_State.rl
|
||||
|
||||
# ==Supported
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Supported.c tsip_parser_header_Supported.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Supported.c tsip_parser_header_Supported.rl
|
||||
|
||||
# ==To
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_To.c tsip_parser_header_To.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_To.c tsip_parser_header_To.rl
|
||||
|
||||
# ==User-Agent
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_User_Agent.c tsip_parser_header_User_Agent.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_User_Agent.c tsip_parser_header_User_Agent.rl
|
||||
|
||||
# ==Via
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Via.c tsip_parser_header_Via.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Via.c tsip_parser_header_Via.rl
|
||||
|
||||
# ==Warning
|
||||
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Warning.c tsip_parser_header_Warning.rl
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Warning.c tsip_parser_header_Warning.rl
|
||||
|
||||
# ==WWW-Authenticate
|
||||
##########ragel.exe $OPTIONS -o ../src/headers/tsip_header_WWW_Authenticate.c tsip_parser_header_WWW_Authenticate.rl
|
||||
#########ragel.exe $OPTIONS -o ../src/headers/tsip_header_WWW_Authenticate.c tsip_parser_header_WWW_Authenticate.rl
|
||||
|
|
|
@ -130,4 +130,4 @@
|
|||
HEADER = ( Accept | Accept_Contact | Accept_Encoding | Accept_Language | Accept_Resource_Priority | Alert_Info | Allow | Allow_Events | Authentication_Info | Authorization | Call_ID | Call_Info | Contact | Content_Disposition | Content_Encoding | Content_Language | Content_Length | Content_Type | CSeq | Date | Error_Info | Event | Expires | From | History_Info | Identity | Identity_Info | In_Reply_To | Join | Max_Forwards | MIME_Version | Min_Expires | Min_SE | Organization | Path | Priority | Privacy | Proxy_Authenticate | Proxy_Authorization | Proxy_Require | RAck | Reason | Record_Route | Refer_Sub | Refer_To | Referred_By | Reject_Contact | Replaces | Reply_To | Request_Disposition | Require | Resource_Priority | Retry_After | Route | RSeq | Security_Client | Security_Server | Security_Verify | Server | Service_Route | Session_Expires | SIP_ETag | SIP_If_Match | Subject | Subscription_State | Supported | Target_Dialog | Timestamp | To | Unsupported | User_Agent | Via | Warning | WWW_Authenticate | P_Access_Network_Info | P_Answer_State | P_Asserted_Identity | P_Associated_URI | P_Called_Party_ID | P_Charging_Function_Addresses | P_Charging_Vector | P_DCS_Billing_Info | P_DCS_LAES | P_DCS_OSPS | P_DCS_Redirect | P_DCS_Trace_Party_ID | P_Early_Media | P_Media_Authorization | P_Preferred_Identity | P_Profile_Key | P_User_Database | P_Visited_Network_ID);
|
||||
|
||||
|
||||
}%%
|
||||
}%%
|
||||
|
|
|
@ -50,4 +50,4 @@
|
|||
# SIP MESSAGE
|
||||
SIP_message = (Response | Request)>1 @eoh message_body?>0;
|
||||
|
||||
}%%
|
||||
}%%
|
||||
|
|
|
@ -193,4 +193,4 @@
|
|||
Method = INVITEm | ACKm | OPTIONSm | BYEm | CANCELm | REGISTERm | INFOm | PRACKm | SUBSCRIBEm | NOTIFYm | UPDATEm | MESSAGEm | REFERm | PUBLISHm | extension_method;
|
||||
method_param = "method="i Method;
|
||||
|
||||
}%%
|
||||
}%%
|
||||
|
|
|
@ -751,4 +751,4 @@ TSIP_BOOLEAN tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message
|
|||
|
||||
return ( cs >= %%{ write first_final; }%% );
|
||||
//return (cs == tsip_machine_parser_headers_first_final);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -171,4 +171,4 @@ static const tsk_object_def_t tsip_header_Allow_def_s =
|
|||
tsip_header_Allow_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Allow_def_t = &tsip_header_Allow_def_s;
|
||||
const void *tsip_header_Allow_def_t = &tsip_header_Allow_def_s;
|
||||
|
|
|
@ -172,4 +172,4 @@ static const tsk_object_def_t tsip_header_Allow_Events_def_s =
|
|||
tsip_header_Allow_Events_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Allow_Events_def_t = &tsip_header_Allow_Events_def_s;
|
||||
const void *tsip_header_Allow_Events_def_t = &tsip_header_Allow_Events_def_s;
|
||||
|
|
|
@ -287,4 +287,4 @@
|
|||
// tsip_header_Authorization_destroy,
|
||||
// 0
|
||||
//};
|
||||
//const void *tsip_header_Authorization_def_t = &tsip_header_Authorization_def_s;
|
||||
//const void *tsip_header_Authorization_def_t = &tsip_header_Authorization_def_s;
|
||||
|
|
|
@ -155,4 +155,5 @@ static const tsk_object_def_t tsip_header_CSeq_def_s =
|
|||
tsip_header_CSeq_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_CSeq_def_t = &tsip_header_CSeq_def_s;
|
||||
const void *tsip_header_CSeq_def_t = &tsip_header_CSeq_def_s;
|
||||
|
||||
|
|
|
@ -161,4 +161,4 @@ static const tsk_object_def_t tsip_header_Call_ID_def_s =
|
|||
tsip_header_Call_ID_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Call_ID_def_t = &tsip_header_Call_ID_def_s;
|
||||
const void *tsip_header_Call_ID_def_t = &tsip_header_Call_ID_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -274,4 +274,4 @@ const void *tsip_header_Contact_def_t = &tsip_header_Contact_def_s;
|
|||
// tsip_contact_destroy,
|
||||
// 0
|
||||
//};
|
||||
//const void *tsip_contact_def_t = &tsip_contact_def_s;
|
||||
//const void *tsip_contact_def_t = &tsip_contact_def_s;
|
||||
|
|
|
@ -148,4 +148,5 @@ static const tsk_object_def_t tsip_header_Content_Length_def_s =
|
|||
tsip_header_Content_Length_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Content_Length_def_t = &tsip_header_Content_Length_def_s;
|
||||
const void *tsip_header_Content_Length_def_t = &tsip_header_Content_Length_def_s;
|
||||
|
||||
|
|
|
@ -174,4 +174,5 @@ static const tsk_object_def_t tsip_header_Content_Type_def_s =
|
|||
tsip_header_Content_Type_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Content_Type_def_t = &tsip_header_Content_Type_def_s;
|
||||
const void *tsip_header_Content_Type_def_t = &tsip_header_Content_Type_def_s;
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -166,4 +166,5 @@ static const tsk_object_def_t tsip_header_Event_def_s =
|
|||
tsip_header_Event_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Event_def_t = &tsip_header_Event_def_s;
|
||||
const void *tsip_header_Event_def_t = &tsip_header_Event_def_s;
|
||||
|
||||
|
|
|
@ -151,4 +151,5 @@ static const tsk_object_def_t tsip_header_Expires_def_s =
|
|||
tsip_header_Expires_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Expires_def_t = &tsip_header_Expires_def_s;
|
||||
const void *tsip_header_Expires_def_t = &tsip_header_Expires_def_s;
|
||||
|
||||
|
|
|
@ -190,4 +190,5 @@ static const tsk_object_def_t tsip_header_From_def_s =
|
|||
tsip_header_From_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_From_def_t = &tsip_header_From_def_s;
|
||||
const void *tsip_header_From_def_t = &tsip_header_From_def_s;
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -151,4 +151,4 @@ static const tsk_object_def_t tsip_header_Max_Forwards_def_s =
|
|||
tsip_header_Max_Forwards_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Max_Forwards_def_t = &tsip_header_Max_Forwards_def_s;
|
||||
const void *tsip_header_Max_Forwards_def_t = &tsip_header_Max_Forwards_def_s;
|
||||
|
|
|
@ -152,4 +152,4 @@ static const tsk_object_def_t tsip_header_Min_Expires_def_s =
|
|||
tsip_header_Min_Expires_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Min_Expires_def_t = &tsip_header_Min_Expires_def_s;
|
||||
const void *tsip_header_Min_Expires_def_t = &tsip_header_Min_Expires_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -163,4 +163,4 @@ static const tsk_object_def_t tsip_header_P_Access_Network_Info_def_s =
|
|||
tsip_header_P_Access_Network_Info_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_P_Access_Network_Info_def_t = &tsip_header_P_Access_Network_Info_def_s;
|
||||
const void *tsip_header_P_Access_Network_Info_def_t = &tsip_header_P_Access_Network_Info_def_s;
|
||||
|
|
|
@ -199,4 +199,4 @@ static const tsk_object_def_t tsip_header_P_Asserted_Identity_def_s =
|
|||
tsip_header_P_Asserted_Identity_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_P_Asserted_Identity_def_t = &tsip_header_P_Asserted_Identity_def_s;
|
||||
const void *tsip_header_P_Asserted_Identity_def_t = &tsip_header_P_Asserted_Identity_def_s;
|
||||
|
|
|
@ -212,4 +212,4 @@ static const tsk_object_def_t tsip_header_P_Associated_URI_def_s =
|
|||
tsip_header_P_Associated_URI_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_P_Associated_URI_def_t = &tsip_header_P_Associated_URI_def_s;
|
||||
const void *tsip_header_P_Associated_URI_def_t = &tsip_header_P_Associated_URI_def_s;
|
||||
|
|
|
@ -201,4 +201,4 @@ static const tsk_object_def_t tsip_header_P_Charging_Function_Addresses_def_s =
|
|||
tsip_header_P_Charging_Function_Addresses_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_P_Charging_Function_Addresses_def_t = &tsip_header_P_Charging_Function_Addresses_def_s;
|
||||
const void *tsip_header_P_Charging_Function_Addresses_def_t = &tsip_header_P_Charging_Function_Addresses_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -181,4 +181,4 @@ static const tsk_object_def_t tsip_header_P_Preferred_Identity_def_s =
|
|||
tsip_header_P_Preferred_Identity_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_P_Preferred_Identity_def_t = &tsip_header_P_Preferred_Identity_def_s;
|
||||
const void *tsip_header_P_Preferred_Identity_def_t = &tsip_header_P_Preferred_Identity_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -213,4 +213,4 @@ static const tsk_object_def_t tsip_header_Path_def_s =
|
|||
tsip_header_Path_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Path_def_t = &tsip_header_Path_def_s;
|
||||
const void *tsip_header_Path_def_t = &tsip_header_Path_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -178,4 +178,4 @@ static const tsk_object_def_t tsip_header_Privacy_def_s =
|
|||
tsip_header_Privacy_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Privacy_def_t = &tsip_header_Privacy_def_s;
|
||||
const void *tsip_header_Privacy_def_t = &tsip_header_Privacy_def_s;
|
||||
|
|
|
@ -247,4 +247,4 @@
|
|||
// tsip_header_Proxy_Authenticate_destroy,
|
||||
// 0
|
||||
//};
|
||||
//const void *tsip_header_Proxy_Authenticate_def_t = &tsip_header_Proxy_Authenticate_def_s;
|
||||
//const void *tsip_header_Proxy_Authenticate_def_t = &tsip_header_Proxy_Authenticate_def_s;
|
||||
|
|
|
@ -288,4 +288,4 @@
|
|||
// tsip_header_Proxy_Authorization_destroy,
|
||||
// 0
|
||||
//};
|
||||
//const void *tsip_header_Proxy_Authorization_def_t = &tsip_header_Proxy_Authorization_def_s;
|
||||
//const void *tsip_header_Proxy_Authorization_def_t = &tsip_header_Proxy_Authorization_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -155,4 +155,4 @@ static const tsk_object_def_t tsip_header_Record_Route_def_s =
|
|||
tsip_header_Record_Route_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Record_Route_def_t = &tsip_header_Record_Route_def_s;
|
||||
const void *tsip_header_Record_Route_def_t = &tsip_header_Record_Route_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -167,4 +167,4 @@ static const tsk_object_def_t tsip_header_Require_def_s =
|
|||
tsip_header_Require_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Require_def_t = &tsip_header_Require_def_s;
|
||||
const void *tsip_header_Require_def_t = &tsip_header_Require_def_s;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue