Update MAC OSX support.
This commit is contained in:
parent
4fbc0d545c
commit
7b2d6e3a81
|
@ -1,329 +1,329 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp.c
|
||||
* @brief DHCP/BOOTP (RFC 2131 - Dynamic Host Configuration Protocol) utilities function for P-CSCF discovery(RFC 3319 and 3361).
|
||||
* Also implement: RFC 3315, 3118, 3319, 3825 (Geoconf), 4676 (Civic Addresses Configuration Information) ...
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tnet_dhcp.h"
|
||||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_thread.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_time.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
//#include <string.h>
|
||||
|
||||
// Useful link: http://support.microsoft.com/?scid=kb%3Ben-us%3B169289&x=21&y=14
|
||||
// Another one: http://www.iana.org/assignments/bootp-dhcp-parameters/
|
||||
// Another one: http://www.slideshare.net/raini/DHCP-Presentation-v102
|
||||
// RFC 3319 Dynamic Host Configuration Protocol (DHCPv6) Options for Session Initiation Protocol (SIP) Servers
|
||||
// RFC 3361 Dynamic Host Configuration Protocol (DHCP-for-IPv4) Option for Session Initiation Protocol (SIP) Servers
|
||||
|
||||
|
||||
/* FIXME: USE retransmission mech (*2*2...)
|
||||
*/
|
||||
tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_request_t* request)
|
||||
{
|
||||
tsk_buffer_t *output;
|
||||
tnet_dhcp_reply_t* reply = 0;
|
||||
int ret;
|
||||
struct timeval tv;
|
||||
fd_set set;
|
||||
uint64_t timeout = 0;
|
||||
tsk_list_item_t *item;
|
||||
const tnet_interface_t *iface;
|
||||
|
||||
tnet_socket_t *localsocket4 = 0;
|
||||
struct sockaddr_storage server;
|
||||
|
||||
if(!ctx || !request)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
localsocket4 = TNET_SOCKET_CREATE(TNET_SOCKET_HOST_ANY, ctx->port_client, tnet_socket_type_udp_ipv4);
|
||||
if(!TNET_SOCKET_IS_VALID(localsocket4))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create/bind DHCP client socket.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Always wait for 200ms before retransmission */
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = (200 * 1000);
|
||||
|
||||
if(tnet_sockaddr_init("255.255.255.255", ctx->server_port, tnet_socket_type_udp_ipv4, &server))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR("Failed to initialize the DHCP server address.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* ENABLE BROADCASTING */
|
||||
{
|
||||
#if defined(SOLARIS)
|
||||
char yes = '1';
|
||||
#else
|
||||
int yes = 1;
|
||||
#endif
|
||||
if(setsockopt(localsocket4->fd, SOL_SOCKET, SO_BROADCAST, (char*)&yes, sizeof(int)))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to enable broadcast option [errno=%d].", tnet_geterrno());
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set timeout */
|
||||
timeout = tsk_time_epoch() + ctx->timeout;
|
||||
|
||||
do
|
||||
{
|
||||
/* RFC 2131 - 3.6 Use of DHCP in clients with multiple interfaces
|
||||
A client with multiple network interfaces must use DHCP through each
|
||||
interface independently to obtain configuration information
|
||||
parameters for those separate interfaces.
|
||||
*/
|
||||
|
||||
tsk_list_foreach(item, ctx->interfaces)
|
||||
{
|
||||
iface = item->data;
|
||||
|
||||
/* Set FD */
|
||||
FD_ZERO(&set);
|
||||
FD_SET(localsocket4->fd, &set);
|
||||
|
||||
/* ciaddr */
|
||||
if(request->type == dhcp_type_inform){
|
||||
struct sockaddr_storage ss;
|
||||
if(!tnet_get_sockaddr(localsocket4->fd, &ss)){
|
||||
uint32_t addr = htonl((*((uint32_t*)&((struct sockaddr_in*)&ss)->sin_addr)));
|
||||
memcpy(&request->ciaddr, &addr, 4);
|
||||
}
|
||||
}
|
||||
|
||||
/* chaddr */
|
||||
memset(request->chaddr, 0, sizeof(request->chaddr));
|
||||
request->hlen = iface->mac_address_length > sizeof(request->chaddr) ? sizeof(request->chaddr) : iface->mac_address_length;
|
||||
memcpy(request->chaddr, iface->mac_address, request->hlen);
|
||||
|
||||
/* Serialize and send to the server. */
|
||||
if(!(output = tnet_dhcp_message_serialize(ctx, request)))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to serialize the DHCP message.");
|
||||
goto next_iface;
|
||||
}
|
||||
/* Send the request to the DHCP server */
|
||||
if((ret =tnet_sockfd_sendto(localsocket4->fd, (const struct sockaddr*)&server, output->data, output->size))<0)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR("Failed to send DHCP request.");
|
||||
|
||||
tsk_thread_sleep(150); // wait 150ms before trying the next iface.
|
||||
goto next_iface;
|
||||
}
|
||||
/* wait for response */
|
||||
if((ret = select(localsocket4->fd+1, &set, NULL, NULL, &tv))<0)
|
||||
{ /* Error */
|
||||
TNET_PRINT_LAST_ERROR("select have failed.");
|
||||
tsk_thread_sleep(150); // wait 150ms before trying the next iface.
|
||||
goto next_iface;
|
||||
}
|
||||
else if(ret == 0)
|
||||
{ /* timeout ==> do nothing */
|
||||
}
|
||||
else
|
||||
{ /* there is data to read */
|
||||
size_t len = 0;
|
||||
void* data = 0;
|
||||
|
||||
/* Check how how many bytes are pending */
|
||||
if((ret = tnet_ioctlt(localsocket4->fd, FIONREAD, &len))<0)
|
||||
{
|
||||
goto next_iface;
|
||||
}
|
||||
|
||||
/* Receive pending data */
|
||||
data = tsk_calloc(len, sizeof(uint8_t));
|
||||
if((ret = tnet_sockfd_recv(localsocket4->fd, data, len, 0))<0)
|
||||
{
|
||||
TSK_FREE(data);
|
||||
|
||||
TNET_PRINT_LAST_ERROR("Failed to receive DHCP dgrams.");
|
||||
goto next_iface;
|
||||
}
|
||||
|
||||
/* Parse the incoming response. */
|
||||
reply = tnet_dhcp_message_deserialize(ctx, data, len);
|
||||
TSK_FREE(data);
|
||||
|
||||
if(reply)
|
||||
{ /* response successfuly parsed */
|
||||
if(request->xid != reply->xid)
|
||||
{ /* Not same transaction id ==> continue*/
|
||||
TSK_OBJECT_SAFE_FREE(reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next_iface:
|
||||
TSK_OBJECT_SAFE_FREE(output);
|
||||
if(reply){
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
break;//FIXME
|
||||
}
|
||||
while(timeout > tsk_time_epoch());
|
||||
|
||||
bail:
|
||||
TSK_OBJECT_SAFE_FREE(localsocket4);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
tnet_dhcp_reply_t* tnet_dhcp_query(tnet_dhcp_ctx_t* ctx, tnet_dhcp_message_type_t type, tnet_dhcp_params_t* params)
|
||||
{
|
||||
tnet_dhcp_reply_t* reply = 0;
|
||||
tnet_dhcp_request_t* request = TNET_DHCP_REQUEST_CREATE();
|
||||
|
||||
if(!ctx || !params || !request)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
request->type = type;
|
||||
tnet_dhcp_message_add_codes(request, params->codes, params->codes_count);
|
||||
|
||||
reply = tnet_dhcp_send_request(ctx, request);
|
||||
|
||||
bail:
|
||||
TSK_OBJECT_SAFE_FREE(request);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
int tnet_dhcp_params_add_code(tnet_dhcp_params_t* params, tnet_dhcp_option_code_t code)
|
||||
{
|
||||
if(params){
|
||||
if(params->codes_count < TNET_DHCP_MAX_CODES){
|
||||
unsigned i;
|
||||
for(i=0; i<params->codes_count; i++){
|
||||
if(params->codes[i] == code){
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
params->codes[params->codes_count++] = code;
|
||||
}
|
||||
else return -2;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// [[DHCP CONTEXT]] object definition
|
||||
//
|
||||
static void* tnet_dhcp_ctx_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_dhcp_ctx_t *ctx = self;
|
||||
if(ctx)
|
||||
{
|
||||
tnet_host_t host;
|
||||
|
||||
ctx->vendor_id = tsk_strdup(TNET_DHCP_VENDOR_ID_DEFAULT);
|
||||
if(!tnet_gethostname(&host)){
|
||||
ctx->hostname = tsk_strndup(host, strlen(host));
|
||||
}
|
||||
ctx->timeout = TNET_DHCP_TIMEOUT_DEFAULT;
|
||||
ctx->max_msg_size = TNET_DHCP_MAX_MSG_SIZE;
|
||||
ctx->port_client = TNET_DHCP_CLIENT_PORT;
|
||||
ctx->server_port = TNET_DHCP_SERVER_PORT;
|
||||
ctx->interfaces = tnet_get_interfaces();
|
||||
|
||||
if(!ctx->interfaces || TSK_LIST_IS_EMPTY(ctx->interfaces))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to retrieve network interfaces.");
|
||||
}
|
||||
|
||||
tsk_safeobj_init(ctx);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_dhcp_ctx_destroy(void * self)
|
||||
{
|
||||
tnet_dhcp_ctx_t *ctx = self;
|
||||
if(ctx)
|
||||
{
|
||||
tsk_safeobj_deinit(ctx);
|
||||
|
||||
TSK_FREE(ctx->vendor_id);
|
||||
TSK_FREE(ctx->hostname);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(ctx->interfaces);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_dhcp_ctx_def_s =
|
||||
{
|
||||
sizeof(tnet_dhcp_ctx_t),
|
||||
tnet_dhcp_ctx_create,
|
||||
tnet_dhcp_ctx_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_dhcp_ctx_def_t = &tnet_dhcp_ctx_def_s;
|
||||
|
||||
//=================================================================================================
|
||||
// [[DHCP PARAMS]] object definition
|
||||
//
|
||||
static void* tnet_dhcp_params_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_dhcp_params_t *params = self;
|
||||
if(params)
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_dhcp_params_destroy(void * self)
|
||||
{
|
||||
tnet_dhcp_params_t *params = self;
|
||||
if(params)
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_dhcp_params_def_s =
|
||||
{
|
||||
sizeof(tnet_dhcp_params_t),
|
||||
tnet_dhcp_params_create,
|
||||
tnet_dhcp_params_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_dhcp_params_def_t = &tnet_dhcp_params_def_s;
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp.c
|
||||
* @brief DHCP/BOOTP (RFC 2131 - Dynamic Host Configuration Protocol) utilities function for P-CSCF discovery(RFC 3319 and 3361).
|
||||
* Also implement: RFC 3315, 3118, 3319, 3825 (Geoconf), 4676 (Civic Addresses Configuration Information) ...
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tnet_dhcp.h"
|
||||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_thread.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_time.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// Useful link: http://support.microsoft.com/?scid=kb%3Ben-us%3B169289&x=21&y=14
|
||||
// Another one: http://www.iana.org/assignments/bootp-dhcp-parameters/
|
||||
// Another one: http://www.slideshare.net/raini/DHCP-Presentation-v102
|
||||
// RFC 3319 Dynamic Host Configuration Protocol (DHCPv6) Options for Session Initiation Protocol (SIP) Servers
|
||||
// RFC 3361 Dynamic Host Configuration Protocol (DHCP-for-IPv4) Option for Session Initiation Protocol (SIP) Servers
|
||||
|
||||
|
||||
/* FIXME: USE retransmission mech (*2*2...)
|
||||
*/
|
||||
tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_request_t* request)
|
||||
{
|
||||
tsk_buffer_t *output;
|
||||
tnet_dhcp_reply_t* reply = 0;
|
||||
int ret;
|
||||
struct timeval tv;
|
||||
fd_set set;
|
||||
uint64_t timeout = 0;
|
||||
tsk_list_item_t *item;
|
||||
const tnet_interface_t *iface;
|
||||
|
||||
tnet_socket_t *localsocket4 = 0;
|
||||
struct sockaddr_storage server;
|
||||
|
||||
if(!ctx || !request)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
localsocket4 = TNET_SOCKET_CREATE(TNET_SOCKET_HOST_ANY, ctx->port_client, tnet_socket_type_udp_ipv4);
|
||||
if(!TNET_SOCKET_IS_VALID(localsocket4))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create/bind DHCP client socket.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Always wait for 200ms before retransmission */
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = (200 * 1000);
|
||||
|
||||
if(tnet_sockaddr_init("255.255.255.255", ctx->server_port, tnet_socket_type_udp_ipv4, &server))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR("Failed to initialize the DHCP server address.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* ENABLE BROADCASTING */
|
||||
{
|
||||
#if defined(SOLARIS)
|
||||
char yes = '1';
|
||||
#else
|
||||
int yes = 1;
|
||||
#endif
|
||||
if(setsockopt(localsocket4->fd, SOL_SOCKET, SO_BROADCAST, (char*)&yes, sizeof(int)))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to enable broadcast option [errno=%d].", tnet_geterrno());
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set timeout */
|
||||
timeout = tsk_time_epoch() + ctx->timeout;
|
||||
|
||||
do
|
||||
{
|
||||
/* RFC 2131 - 3.6 Use of DHCP in clients with multiple interfaces
|
||||
A client with multiple network interfaces must use DHCP through each
|
||||
interface independently to obtain configuration information
|
||||
parameters for those separate interfaces.
|
||||
*/
|
||||
|
||||
tsk_list_foreach(item, ctx->interfaces)
|
||||
{
|
||||
iface = item->data;
|
||||
|
||||
/* Set FD */
|
||||
FD_ZERO(&set);
|
||||
FD_SET(localsocket4->fd, &set);
|
||||
|
||||
/* ciaddr */
|
||||
if(request->type == dhcp_type_inform){
|
||||
struct sockaddr_storage ss;
|
||||
if(!tnet_get_sockaddr(localsocket4->fd, &ss)){
|
||||
uint32_t addr = htonl((*((uint32_t*)&((struct sockaddr_in*)&ss)->sin_addr)));
|
||||
memcpy(&request->ciaddr, &addr, 4);
|
||||
}
|
||||
}
|
||||
|
||||
/* chaddr */
|
||||
memset(request->chaddr, 0, sizeof(request->chaddr));
|
||||
request->hlen = iface->mac_address_length > sizeof(request->chaddr) ? sizeof(request->chaddr) : iface->mac_address_length;
|
||||
memcpy(request->chaddr, iface->mac_address, request->hlen);
|
||||
|
||||
/* Serialize and send to the server. */
|
||||
if(!(output = tnet_dhcp_message_serialize(ctx, request)))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to serialize the DHCP message.");
|
||||
goto next_iface;
|
||||
}
|
||||
/* Send the request to the DHCP server */
|
||||
if((ret =tnet_sockfd_sendto(localsocket4->fd, (const struct sockaddr*)&server, output->data, output->size))<0)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR("Failed to send DHCP request.");
|
||||
|
||||
tsk_thread_sleep(150); // wait 150ms before trying the next iface.
|
||||
goto next_iface;
|
||||
}
|
||||
/* wait for response */
|
||||
if((ret = select(localsocket4->fd+1, &set, NULL, NULL, &tv))<0)
|
||||
{ /* Error */
|
||||
TNET_PRINT_LAST_ERROR("select have failed.");
|
||||
tsk_thread_sleep(150); // wait 150ms before trying the next iface.
|
||||
goto next_iface;
|
||||
}
|
||||
else if(ret == 0)
|
||||
{ /* timeout ==> do nothing */
|
||||
}
|
||||
else
|
||||
{ /* there is data to read */
|
||||
size_t len = 0;
|
||||
void* data = 0;
|
||||
|
||||
/* Check how how many bytes are pending */
|
||||
if((ret = tnet_ioctlt(localsocket4->fd, FIONREAD, &len))<0)
|
||||
{
|
||||
goto next_iface;
|
||||
}
|
||||
|
||||
/* Receive pending data */
|
||||
data = tsk_calloc(len, sizeof(uint8_t));
|
||||
if((ret = tnet_sockfd_recv(localsocket4->fd, data, len, 0))<0)
|
||||
{
|
||||
TSK_FREE(data);
|
||||
|
||||
TNET_PRINT_LAST_ERROR("Failed to receive DHCP dgrams.");
|
||||
goto next_iface;
|
||||
}
|
||||
|
||||
/* Parse the incoming response. */
|
||||
reply = tnet_dhcp_message_deserialize(ctx, data, len);
|
||||
TSK_FREE(data);
|
||||
|
||||
if(reply)
|
||||
{ /* response successfuly parsed */
|
||||
if(request->xid != reply->xid)
|
||||
{ /* Not same transaction id ==> continue*/
|
||||
TSK_OBJECT_SAFE_FREE(reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next_iface:
|
||||
TSK_OBJECT_SAFE_FREE(output);
|
||||
if(reply){
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
break;//FIXME
|
||||
}
|
||||
while(timeout > tsk_time_epoch());
|
||||
|
||||
bail:
|
||||
TSK_OBJECT_SAFE_FREE(localsocket4);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
tnet_dhcp_reply_t* tnet_dhcp_query(tnet_dhcp_ctx_t* ctx, tnet_dhcp_message_type_t type, tnet_dhcp_params_t* params)
|
||||
{
|
||||
tnet_dhcp_reply_t* reply = 0;
|
||||
tnet_dhcp_request_t* request = TNET_DHCP_REQUEST_CREATE();
|
||||
|
||||
if(!ctx || !params || !request)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
request->type = type;
|
||||
tnet_dhcp_message_add_codes(request, params->codes, params->codes_count);
|
||||
|
||||
reply = tnet_dhcp_send_request(ctx, request);
|
||||
|
||||
bail:
|
||||
TSK_OBJECT_SAFE_FREE(request);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
int tnet_dhcp_params_add_code(tnet_dhcp_params_t* params, tnet_dhcp_option_code_t code)
|
||||
{
|
||||
if(params){
|
||||
if(params->codes_count < TNET_DHCP_MAX_CODES){
|
||||
unsigned i;
|
||||
for(i=0; i<params->codes_count; i++){
|
||||
if(params->codes[i] == code){
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
params->codes[params->codes_count++] = code;
|
||||
}
|
||||
else return -2;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// [[DHCP CONTEXT]] object definition
|
||||
//
|
||||
static void* tnet_dhcp_ctx_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_dhcp_ctx_t *ctx = self;
|
||||
if(ctx)
|
||||
{
|
||||
tnet_host_t host;
|
||||
|
||||
ctx->vendor_id = tsk_strdup(TNET_DHCP_VENDOR_ID_DEFAULT);
|
||||
if(!tnet_gethostname(&host)){
|
||||
ctx->hostname = tsk_strndup(host, strlen(host));
|
||||
}
|
||||
ctx->timeout = TNET_DHCP_TIMEOUT_DEFAULT;
|
||||
ctx->max_msg_size = TNET_DHCP_MAX_MSG_SIZE;
|
||||
ctx->port_client = TNET_DHCP_CLIENT_PORT;
|
||||
ctx->server_port = TNET_DHCP_SERVER_PORT;
|
||||
ctx->interfaces = tnet_get_interfaces();
|
||||
|
||||
if(!ctx->interfaces || TSK_LIST_IS_EMPTY(ctx->interfaces))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to retrieve network interfaces.");
|
||||
}
|
||||
|
||||
tsk_safeobj_init(ctx);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_dhcp_ctx_destroy(void * self)
|
||||
{
|
||||
tnet_dhcp_ctx_t *ctx = self;
|
||||
if(ctx)
|
||||
{
|
||||
tsk_safeobj_deinit(ctx);
|
||||
|
||||
TSK_FREE(ctx->vendor_id);
|
||||
TSK_FREE(ctx->hostname);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(ctx->interfaces);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_dhcp_ctx_def_s =
|
||||
{
|
||||
sizeof(tnet_dhcp_ctx_t),
|
||||
tnet_dhcp_ctx_create,
|
||||
tnet_dhcp_ctx_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_dhcp_ctx_def_t = &tnet_dhcp_ctx_def_s;
|
||||
|
||||
//=================================================================================================
|
||||
// [[DHCP PARAMS]] object definition
|
||||
//
|
||||
static void* tnet_dhcp_params_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_dhcp_params_t *params = self;
|
||||
if(params)
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_dhcp_params_destroy(void * self)
|
||||
{
|
||||
tnet_dhcp_params_t *params = self;
|
||||
if(params)
|
||||
{
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_dhcp_params_def_s =
|
||||
{
|
||||
sizeof(tnet_dhcp_params_t),
|
||||
tnet_dhcp_params_create,
|
||||
tnet_dhcp_params_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_dhcp_params_def_t = &tnet_dhcp_params_def_s;
|
||||
|
|
|
@ -1,105 +1,105 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp.h
|
||||
* @brief DHCP (RFC 2131 - Dynamic Host Configuration Protocol) utilities function for P-CSCF discovery(RFC 3319 and 3361)
|
||||
* Also implement: RFC 3315, 3118, 3319, 3825 (Geoconf), 4676 (Civic Addresses Configuration Information)...
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#ifndef TNET_DHCP_H
|
||||
#define TNET_DHCP_H
|
||||
|
||||
#include "tinyNET_config.h"
|
||||
|
||||
#include "tnet_dhcp_message.h"
|
||||
|
||||
#include "tnet_utils.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_safeobj.h"
|
||||
|
||||
TNET_BEGIN_DECLS
|
||||
|
||||
#define TNET_DHCP_CTX_CREATE() tsk_object_new(tnet_dhcp_ctx_def_t)
|
||||
#define TNET_DHCP_PARAMS_CREATE() tsk_object_new(tnet_dhcp_params_def_t)
|
||||
|
||||
/** Default timeout (in milliseconds) value for DHCP requests.
|
||||
*/
|
||||
#define TNET_DHCP_TIMEOUT_DEFAULT 2000
|
||||
|
||||
/**< Local port(client) to bind to for incoming DHCP messages as per RFC 2131 subclause 4.1. */
|
||||
#define TNET_DHCP_CLIENT_PORT 68
|
||||
/**< Destination port(Server) for outgoing DHCP messages as per RFC 2131 subclause 4.1. */
|
||||
#define TNET_DHCP_SERVER_PORT 67
|
||||
|
||||
#define TNET_DHCP_VENDOR_ID_DEFAULT "doubango/v0.0.0"
|
||||
#define TNET_DHCP_MAX_CODES 20
|
||||
#define TNET_DHCP_MAX_MSG_SIZE 1500
|
||||
|
||||
/** Parameter Request List (55)
|
||||
*/
|
||||
typedef struct tnet_dhcp_params_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
tnet_dhcp_option_code_t codes[TNET_DHCP_MAX_CODES];
|
||||
unsigned codes_count;
|
||||
}
|
||||
tnet_dhcp_params_t;
|
||||
|
||||
typedef struct tnet_dhcp_ctx_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
char* vendor_id;
|
||||
char* hostname;
|
||||
uint16_t max_msg_size; /**< Option code 57. */
|
||||
|
||||
uint64_t timeout;
|
||||
|
||||
tnet_port_t port_client; /**< Local port to bind to for incloming DHCP messages. Default: 68 */
|
||||
tnet_port_t server_port; /**< Destination port for outgoing DHCP messages. Default: 64 */
|
||||
tnet_interfaces_L_t *interfaces;
|
||||
|
||||
TSK_DECLARE_SAFEOBJ;
|
||||
}
|
||||
tnet_dhcp_ctx_t;
|
||||
|
||||
|
||||
TINYNET_API tnet_dhcp_reply_t* tnet_dhcp_query(tnet_dhcp_ctx_t* ctx, tnet_dhcp_message_type_t type, tnet_dhcp_params_t* params);
|
||||
#define tnet_dhcp_query_discover(ctx, params) tnet_dhcp_query(ctx, dhcp_type_discover, params)
|
||||
#define tnet_dhcp_query_request(ctx, params) tnet_dhcp_query(ctx, dhcp_type_request, params)
|
||||
#define tnet_dhcp_query_decline(ctx, params) tnet_dhcp_query(ctx, dhcp_type_decline, params)
|
||||
#define tnet_dhcp_query_release(ctx, params) tnet_dhcp_query(ctx, dhcp_type_release, params)
|
||||
#define tnet_dhcp_query_inform(ctx, params) tnet_dhcp_query(ctx, dhcp_type_inform, params)
|
||||
|
||||
TINYNET_API int tnet_dhcp_params_add_code(tnet_dhcp_params_t* params, tnet_dhcp_option_code_t code);
|
||||
|
||||
TINYNET_GEXTERN const void *tnet_dhcp_ctx_def_t;
|
||||
TINYNET_GEXTERN const void *tnet_dhcp_params_def_t;
|
||||
|
||||
TNET_END_DECLS
|
||||
|
||||
#endif /* TNET_DHCP_H */
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp.h
|
||||
* @brief DHCP (RFC 2131 - Dynamic Host Configuration Protocol) utilities function for P-CSCF discovery(RFC 3319 and 3361)
|
||||
* Also implement: RFC 3315, 3118, 3319, 3825 (Geoconf), 4676 (Civic Addresses Configuration Information)...
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#ifndef TNET_DHCP_H
|
||||
#define TNET_DHCP_H
|
||||
|
||||
#include "tinyNET_config.h"
|
||||
|
||||
#include "tnet_dhcp_message.h"
|
||||
|
||||
#include "tnet_utils.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_safeobj.h"
|
||||
|
||||
TNET_BEGIN_DECLS
|
||||
|
||||
#define TNET_DHCP_CTX_CREATE() tsk_object_new(tnet_dhcp_ctx_def_t)
|
||||
#define TNET_DHCP_PARAMS_CREATE() tsk_object_new(tnet_dhcp_params_def_t)
|
||||
|
||||
/** Default timeout (in milliseconds) value for DHCP requests.
|
||||
*/
|
||||
#define TNET_DHCP_TIMEOUT_DEFAULT 2000
|
||||
|
||||
/**< Local port(client) to bind to for incoming DHCP messages as per RFC 2131 subclause 4.1. */
|
||||
#define TNET_DHCP_CLIENT_PORT 68
|
||||
/**< Destination port(Server) for outgoing DHCP messages as per RFC 2131 subclause 4.1. */
|
||||
#define TNET_DHCP_SERVER_PORT 67
|
||||
|
||||
#define TNET_DHCP_VENDOR_ID_DEFAULT "doubango/v0.0.0"
|
||||
#define TNET_DHCP_MAX_CODES 20
|
||||
#define TNET_DHCP_MAX_MSG_SIZE 1500
|
||||
|
||||
/** Parameter Request List (55)
|
||||
*/
|
||||
typedef struct tnet_dhcp_params_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
tnet_dhcp_option_code_t codes[TNET_DHCP_MAX_CODES];
|
||||
unsigned codes_count;
|
||||
}
|
||||
tnet_dhcp_params_t;
|
||||
|
||||
typedef struct tnet_dhcp_ctx_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
char* vendor_id;
|
||||
char* hostname;
|
||||
uint16_t max_msg_size; /**< Option code 57. */
|
||||
|
||||
uint64_t timeout;
|
||||
|
||||
tnet_port_t port_client; /**< Local port to bind to for incloming DHCP messages. Default: 68 */
|
||||
tnet_port_t server_port; /**< Destination port for outgoing DHCP messages. Default: 64 */
|
||||
tnet_interfaces_L_t *interfaces;
|
||||
|
||||
TSK_DECLARE_SAFEOBJ;
|
||||
}
|
||||
tnet_dhcp_ctx_t;
|
||||
|
||||
|
||||
TINYNET_API tnet_dhcp_reply_t* tnet_dhcp_query(tnet_dhcp_ctx_t* ctx, tnet_dhcp_message_type_t type, tnet_dhcp_params_t* params);
|
||||
#define tnet_dhcp_query_discover(ctx, params) tnet_dhcp_query(ctx, dhcp_type_discover, params)
|
||||
#define tnet_dhcp_query_request(ctx, params) tnet_dhcp_query(ctx, dhcp_type_request, params)
|
||||
#define tnet_dhcp_query_decline(ctx, params) tnet_dhcp_query(ctx, dhcp_type_decline, params)
|
||||
#define tnet_dhcp_query_release(ctx, params) tnet_dhcp_query(ctx, dhcp_type_release, params)
|
||||
#define tnet_dhcp_query_inform(ctx, params) tnet_dhcp_query(ctx, dhcp_type_inform, params)
|
||||
|
||||
TINYNET_API int tnet_dhcp_params_add_code(tnet_dhcp_params_t* params, tnet_dhcp_option_code_t code);
|
||||
|
||||
TINYNET_GEXTERN const void *tnet_dhcp_ctx_def_t;
|
||||
TINYNET_GEXTERN const void *tnet_dhcp_params_def_t;
|
||||
|
||||
TNET_END_DECLS
|
||||
|
||||
#endif /* TNET_DHCP_H */
|
||||
|
|
|
@ -1,303 +1,305 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp_message.c
|
||||
* @brief DHCP Message as per RFC 2131 subclause 2.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tnet_dhcp_message.h"
|
||||
#include "tnet_dhcp.h"
|
||||
|
||||
#include "../tnet_utils.h"
|
||||
|
||||
#include "tsk_time.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
tsk_buffer_t* tnet_dhcp_message_serialize(const struct tnet_dhcp_ctx_s *ctx, const tnet_dhcp_message_t *message)
|
||||
{
|
||||
tsk_buffer_t* output = 0;
|
||||
uint8_t _1byte;
|
||||
uint16_t _2bytes;
|
||||
uint32_t _4bytes;
|
||||
|
||||
/* Check message validity */
|
||||
if(!message){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
output = TSK_BUFFER_CREATE_NULL();
|
||||
|
||||
/*== OP HTYPE HLEN HOPS */
|
||||
_4bytes = (((uint32_t)(message->op)) << 24) |
|
||||
(((uint32_t)(message->htype)) << 16) |
|
||||
(((uint16_t)(message->hlen)) << 8) | message->hops;
|
||||
_4bytes = ntohl(_4bytes);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
|
||||
/*== XID */
|
||||
_4bytes = ntohl(message->xid);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== SECS */
|
||||
_2bytes = ntohs(message->secs);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
/*== FLAGS */
|
||||
_2bytes = ntohs(message->flags);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
/*== CIADDR */
|
||||
_4bytes = ntohl(message->ciaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== YIADDR */
|
||||
_4bytes = ntohl(message->yiaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== SIADDR */
|
||||
_4bytes = ntohl(message->siaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== GIADDR */
|
||||
_4bytes = ntohl(message->giaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== CHADDR */
|
||||
tsk_buffer_append(output, message->chaddr, sizeof(message->chaddr));
|
||||
/*== sname (unused) */
|
||||
tsk_buffer_append(output, message->sname, sizeof(message->sname));
|
||||
/*== file (unused) */
|
||||
tsk_buffer_append(output, message->file, sizeof(message->file));
|
||||
/*== Magic Cookie */
|
||||
_4bytes = ntohl(TNET_DHCP_MAGIC_COOKIE);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
|
||||
/*== Message Type (option 53)
|
||||
*/
|
||||
tnet_dhcp_option_serializeex(dhcp_code_DHCP_Msg_Type, 1, &message->type, output);
|
||||
|
||||
/*== Client Identifier (option 61) ==> RFC 2132 - 9.14. Client-identifier
|
||||
Code Len Type Client-Identifier
|
||||
+-----+-----+-----+-----+-----+---
|
||||
| 61 | n | t1 | i1 | i2 | ...
|
||||
+-----+-----+-----+-----+-----+---
|
||||
*/
|
||||
if(message->hlen){
|
||||
uint8_t client_id[17]; // 16 /*sizeof(chaddr)*/+ 1/*htype*/
|
||||
/*if(client_id)*/{
|
||||
client_id[0] = message->htype;
|
||||
memcpy(&client_id[1], message->chaddr, message->hlen);
|
||||
tnet_dhcp_option_serializeex(dhcp_code_Client_Id, (message->hlen+1), client_id, output);
|
||||
}
|
||||
}
|
||||
/*== Host name(10) ==> RFC 2132 - 3.14. Host Name Option
|
||||
Code Len Host Name
|
||||
+-----+-----+-----+-----+-----+-----+-----+-----+--
|
||||
| 12 | n | h1 | h2 | h3 | h4 | h5 | h6 | ...
|
||||
+-----+-----+-----+-----+-----+-----+-----+-----+--
|
||||
*/
|
||||
if(TNET_DHCP_MESSAGE_IS_REQUEST(message) && ctx->hostname){
|
||||
tnet_dhcp_option_serializeex(dhcp_code_Hostname, strlen(ctx->hostname), ctx->hostname, output);
|
||||
}
|
||||
/*== Vendor classId(60) ==> RFC 2132 - 9.13. Vendor class identifier
|
||||
Code Len Vendor class Identifier
|
||||
+-----+-----+-----+-----+---
|
||||
| 60 | n | i1 | i2 | ...
|
||||
+-----+-----+-----+-----+---
|
||||
*/
|
||||
if(TNET_DHCP_MESSAGE_IS_REQUEST(message) && ctx->vendor_id){
|
||||
tnet_dhcp_option_serializeex(dhcp_code_Class_Id, strlen(ctx->vendor_id), ctx->vendor_id, output);
|
||||
}
|
||||
|
||||
/*== RFC 2132 - 9.10. Maximum DHCP Message Size (57)
|
||||
Code Len Length
|
||||
+-----+-----+-----+-----+
|
||||
| 57 | 2 | l1 | l2 |
|
||||
+-----+-----+-----+-----+
|
||||
*/
|
||||
if(TNET_DHCP_MESSAGE_IS_REQUEST(message) && ctx->max_msg_size){
|
||||
_2bytes = ntohs(ctx->max_msg_size);
|
||||
tnet_dhcp_option_serializeex(dhcp_code_DHCP_Max_Msg_Size, 2, &_2bytes, output);
|
||||
}
|
||||
|
||||
/*== DHCP Options
|
||||
*/
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tnet_dhcp_option_t* option;
|
||||
tsk_list_foreach(item, message->options)
|
||||
{
|
||||
option = (tnet_dhcp_option_t*)item->data;
|
||||
if(tnet_dhcp_option_serialize(option, output)){
|
||||
TSK_DEBUG_WARN("Failed to serialize DHCP OPTION (%u)", option->code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RFC 2131 - 4.1 Constructing and sending DHCP messages
|
||||
The last option must always be the 'end' option.
|
||||
*/
|
||||
_1byte = dhcp_code_End;
|
||||
tsk_buffer_append(output, &(_1byte), 1);
|
||||
|
||||
bail:
|
||||
return output;
|
||||
}
|
||||
|
||||
tnet_dhcp_message_t* tnet_dhcp_message_deserialize(const struct tnet_dhcp_ctx_s *ctx, const uint8_t *data, size_t size)
|
||||
{
|
||||
tnet_dhcp_message_t *message = 0;
|
||||
uint8_t *dataPtr, *dataEnd, *dataStart;
|
||||
|
||||
if(!data || !size)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if(size < TNET_DHCP_MESSAGE_MIN_SIZE){
|
||||
TSK_DEBUG_ERROR("DHCP message too short.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if(!(message = TNET_DHCP_REPLY_CREATE())){ /* If REQUEST OP will be overridedden */
|
||||
TSK_DEBUG_ERROR("Failed to create new DHCP message.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dataPtr = (uint8_t*)data;
|
||||
dataStart = dataPtr;
|
||||
dataEnd = (dataStart + size);
|
||||
|
||||
/*== op (1)*/
|
||||
message->op = *(dataPtr++);
|
||||
/*== htype (1) */
|
||||
message->htype = *(dataPtr++);
|
||||
/*== hlen (1) */
|
||||
message->hlen = *(dataPtr++);
|
||||
/*== htype (1) */
|
||||
message->hops = *(dataPtr++);
|
||||
/*== xid (4) */
|
||||
message->xid= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== secs (2) */
|
||||
message->secs = ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
/*== flags (2) */
|
||||
message->flags = ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
/*== ciaddr (4) */
|
||||
message->ciaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== yiaddr (4) */
|
||||
message->yiaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== siaddr (4) */
|
||||
message->siaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== giaddr (4) */
|
||||
message->giaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== chaddr (16[max]) */
|
||||
memcpy(message->chaddr, dataPtr, message->hlen>16 ? 16 : message->hlen);
|
||||
dataPtr += 16;
|
||||
/*== sname (64) */
|
||||
memcpy(message->sname, dataPtr, 64);
|
||||
dataPtr += 64;
|
||||
/*== file (128) */
|
||||
memcpy(message->file, dataPtr, 128);
|
||||
dataPtr += 128;
|
||||
/*== Magic Cookie (4) */
|
||||
if(ntohl(*((uint32_t*)dataPtr)) != TNET_DHCP_MAGIC_COOKIE){
|
||||
TSK_DEBUG_ERROR("Invalid DHCP magic cookie.");
|
||||
// Do not exit ==> continue parsing.
|
||||
}
|
||||
dataPtr += 4;
|
||||
|
||||
/*== options (variable) */
|
||||
while(dataPtr<dataEnd && *dataPtr!=dhcp_code_End)
|
||||
{
|
||||
tnet_dhcp_option_t* option = tnet_dhcp_option_deserialize(dataPtr, (dataEnd-dataPtr));
|
||||
if(option && option->value){
|
||||
|
||||
if(option->code == dhcp_code_DHCP_Msg_Type){
|
||||
message->type = (tnet_dhcp_message_type_t)*TSK_BUFFER_TO_U8(option->value);
|
||||
}
|
||||
|
||||
dataPtr += option->value->size + 2/*Code Len*/;
|
||||
tsk_list_push_back_data(message->options, (void**)&option);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
bail:
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
const tnet_dhcp_option_t* tnet_dhcp_message_find_option(const tnet_dhcp_message_t *message, tnet_dhcp_option_code_t code)
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
|
||||
if(!message){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
tsk_list_foreach(item, message->options)
|
||||
{
|
||||
if(((tnet_dhcp_option_t*)item->data)->code == code){
|
||||
return ((tnet_dhcp_option_t*)item->data);
|
||||
}
|
||||
}
|
||||
|
||||
bail:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tnet_dhcp_message_add_codes(tnet_dhcp_message_t *self, tnet_dhcp_option_code_t codes[], unsigned codes_count)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(!self){
|
||||
goto bail;
|
||||
}
|
||||
if(codes_count){
|
||||
unsigned i;
|
||||
|
||||
tnet_dhcp_option_paramslist_t* option = (tnet_dhcp_option_paramslist_t*)tnet_dhcp_message_find_option(self, dhcp_code_Parameter_List);
|
||||
if(!option){
|
||||
tnet_dhcp_option_paramslist_t *option_paramslist = TNET_DHCP_OPTION_PARAMSLIST_CREATE();
|
||||
option = option_paramslist;
|
||||
tsk_list_push_back_data(self->options, (void**)&option_paramslist);
|
||||
}
|
||||
|
||||
for(i=0; i<codes_count; i++){
|
||||
if((ret = tnet_dhcp_option_paramslist_add_code(option, codes[i]))){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp_message.c
|
||||
* @brief DHCP Message as per RFC 2131 subclause 2.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tnet_dhcp_message.h"
|
||||
#include "tnet_dhcp.h"
|
||||
|
||||
#include "../tnet_utils.h"
|
||||
|
||||
#include "tsk_time.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
tsk_buffer_t* tnet_dhcp_message_serialize(const tnet_dhcp_ctx_t *ctx, const tnet_dhcp_message_t *message)
|
||||
{
|
||||
tsk_buffer_t* output = 0;
|
||||
uint8_t _1byte;
|
||||
uint16_t _2bytes;
|
||||
uint32_t _4bytes;
|
||||
|
||||
/* Check message validity */
|
||||
if(!message){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
output = TSK_BUFFER_CREATE_NULL();
|
||||
|
||||
/*== OP HTYPE HLEN HOPS */
|
||||
_4bytes = (((uint32_t)(message->op)) << 24) |
|
||||
(((uint32_t)(message->htype)) << 16) |
|
||||
(((uint16_t)(message->hlen)) << 8) | message->hops;
|
||||
_4bytes = ntohl(_4bytes);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
|
||||
/*== XID */
|
||||
_4bytes = ntohl(message->xid);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== SECS */
|
||||
_2bytes = ntohs(message->secs);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
/*== FLAGS */
|
||||
_2bytes = ntohs(message->flags);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
/*== CIADDR */
|
||||
_4bytes = ntohl(message->ciaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== YIADDR */
|
||||
_4bytes = ntohl(message->yiaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== SIADDR */
|
||||
_4bytes = ntohl(message->siaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== GIADDR */
|
||||
_4bytes = ntohl(message->giaddr);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
/*== CHADDR */
|
||||
tsk_buffer_append(output, message->chaddr, sizeof(message->chaddr));
|
||||
/*== sname (unused) */
|
||||
tsk_buffer_append(output, message->sname, sizeof(message->sname));
|
||||
/*== file (unused) */
|
||||
tsk_buffer_append(output, message->file, sizeof(message->file));
|
||||
/*== Magic Cookie */
|
||||
_4bytes = ntohl(TNET_DHCP_MAGIC_COOKIE);
|
||||
tsk_buffer_append(output, &(_4bytes), 4);
|
||||
|
||||
/*== Message Type (option 53)
|
||||
*/
|
||||
tnet_dhcp_option_serializeex(dhcp_code_DHCP_Msg_Type, 1, &message->type, output);
|
||||
|
||||
/*== Client Identifier (option 61) ==> RFC 2132 - 9.14. Client-identifier
|
||||
Code Len Type Client-Identifier
|
||||
+-----+-----+-----+-----+-----+---
|
||||
| 61 | n | t1 | i1 | i2 | ...
|
||||
+-----+-----+-----+-----+-----+---
|
||||
*/
|
||||
if(message->hlen){
|
||||
uint8_t client_id[17]; // 16 /*sizeof(chaddr)*/+ 1/*htype*/
|
||||
/*if(client_id)*/{
|
||||
client_id[0] = message->htype;
|
||||
memcpy(&client_id[1], message->chaddr, message->hlen);
|
||||
tnet_dhcp_option_serializeex(dhcp_code_Client_Id, (message->hlen+1), client_id, output);
|
||||
}
|
||||
}
|
||||
/*== Host name(10) ==> RFC 2132 - 3.14. Host Name Option
|
||||
Code Len Host Name
|
||||
+-----+-----+-----+-----+-----+-----+-----+-----+--
|
||||
| 12 | n | h1 | h2 | h3 | h4 | h5 | h6 | ...
|
||||
+-----+-----+-----+-----+-----+-----+-----+-----+--
|
||||
*/
|
||||
if(TNET_DHCP_MESSAGE_IS_REQUEST(message) && ctx->hostname){
|
||||
tnet_dhcp_option_serializeex(dhcp_code_Hostname, strlen(ctx->hostname), ctx->hostname, output);
|
||||
}
|
||||
/*== Vendor classId(60) ==> RFC 2132 - 9.13. Vendor class identifier
|
||||
Code Len Vendor class Identifier
|
||||
+-----+-----+-----+-----+---
|
||||
| 60 | n | i1 | i2 | ...
|
||||
+-----+-----+-----+-----+---
|
||||
*/
|
||||
if(TNET_DHCP_MESSAGE_IS_REQUEST(message) && ctx->vendor_id){
|
||||
tnet_dhcp_option_serializeex(dhcp_code_Class_Id, strlen(ctx->vendor_id), ctx->vendor_id, output);
|
||||
}
|
||||
|
||||
/*== RFC 2132 - 9.10. Maximum DHCP Message Size (57)
|
||||
Code Len Length
|
||||
+-----+-----+-----+-----+
|
||||
| 57 | 2 | l1 | l2 |
|
||||
+-----+-----+-----+-----+
|
||||
*/
|
||||
if(TNET_DHCP_MESSAGE_IS_REQUEST(message) && ctx->max_msg_size){
|
||||
_2bytes = ntohs(ctx->max_msg_size);
|
||||
tnet_dhcp_option_serializeex(dhcp_code_DHCP_Max_Msg_Size, 2, &_2bytes, output);
|
||||
}
|
||||
|
||||
/*== DHCP Options
|
||||
*/
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tnet_dhcp_option_t* option;
|
||||
tsk_list_foreach(item, message->options)
|
||||
{
|
||||
option = (tnet_dhcp_option_t*)item->data;
|
||||
if(tnet_dhcp_option_serialize(option, output)){
|
||||
TSK_DEBUG_WARN("Failed to serialize DHCP OPTION (%u)", option->code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RFC 2131 - 4.1 Constructing and sending DHCP messages
|
||||
The last option must always be the 'end' option.
|
||||
*/
|
||||
_1byte = dhcp_code_End;
|
||||
tsk_buffer_append(output, &(_1byte), 1);
|
||||
|
||||
bail:
|
||||
return output;
|
||||
}
|
||||
|
||||
tnet_dhcp_message_t* tnet_dhcp_message_deserialize(const struct tnet_dhcp_ctx_s *ctx, const uint8_t *data, size_t size)
|
||||
{
|
||||
tnet_dhcp_message_t *message = 0;
|
||||
uint8_t *dataPtr, *dataEnd, *dataStart;
|
||||
|
||||
if(!data || !size)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if(size < TNET_DHCP_MESSAGE_MIN_SIZE){
|
||||
TSK_DEBUG_ERROR("DHCP message too short.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if(!(message = TNET_DHCP_REPLY_CREATE())){ /* If REQUEST OP will be overridedden */
|
||||
TSK_DEBUG_ERROR("Failed to create new DHCP message.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dataPtr = (uint8_t*)data;
|
||||
dataStart = dataPtr;
|
||||
dataEnd = (dataStart + size);
|
||||
|
||||
/*== op (1)*/
|
||||
message->op = *(dataPtr++);
|
||||
/*== htype (1) */
|
||||
message->htype = *(dataPtr++);
|
||||
/*== hlen (1) */
|
||||
message->hlen = *(dataPtr++);
|
||||
/*== htype (1) */
|
||||
message->hops = *(dataPtr++);
|
||||
/*== xid (4) */
|
||||
message->xid= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== secs (2) */
|
||||
message->secs = ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
/*== flags (2) */
|
||||
message->flags = ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
/*== ciaddr (4) */
|
||||
message->ciaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== yiaddr (4) */
|
||||
message->yiaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== siaddr (4) */
|
||||
message->siaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== giaddr (4) */
|
||||
message->giaddr= ntohl(*((uint32_t*)dataPtr));
|
||||
dataPtr += 4;
|
||||
/*== chaddr (16[max]) */
|
||||
memcpy(message->chaddr, dataPtr, message->hlen>16 ? 16 : message->hlen);
|
||||
dataPtr += 16;
|
||||
/*== sname (64) */
|
||||
memcpy(message->sname, dataPtr, 64);
|
||||
dataPtr += 64;
|
||||
/*== file (128) */
|
||||
memcpy(message->file, dataPtr, 128);
|
||||
dataPtr += 128;
|
||||
/*== Magic Cookie (4) */
|
||||
if(ntohl(*((uint32_t*)dataPtr)) != TNET_DHCP_MAGIC_COOKIE){
|
||||
TSK_DEBUG_ERROR("Invalid DHCP magic cookie.");
|
||||
// Do not exit ==> continue parsing.
|
||||
}
|
||||
dataPtr += 4;
|
||||
|
||||
/*== options (variable) */
|
||||
while(dataPtr<dataEnd && *dataPtr!=dhcp_code_End)
|
||||
{
|
||||
tnet_dhcp_option_t* option = tnet_dhcp_option_deserialize(dataPtr, (dataEnd-dataPtr));
|
||||
if(option && option->value){
|
||||
|
||||
if(option->code == dhcp_code_DHCP_Msg_Type){
|
||||
message->type = (tnet_dhcp_message_type_t)*TSK_BUFFER_TO_U8(option->value);
|
||||
}
|
||||
|
||||
dataPtr += option->value->size + 2/*Code Len*/;
|
||||
tsk_list_push_back_data(message->options, (void**)&option);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
bail:
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
const tnet_dhcp_option_t* tnet_dhcp_message_find_option(const tnet_dhcp_message_t *message, tnet_dhcp_option_code_t code)
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
|
||||
if(!message){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
tsk_list_foreach(item, message->options)
|
||||
{
|
||||
if(((tnet_dhcp_option_t*)item->data)->code == code){
|
||||
return ((tnet_dhcp_option_t*)item->data);
|
||||
}
|
||||
}
|
||||
|
||||
bail:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tnet_dhcp_message_add_codes(tnet_dhcp_message_t *self, tnet_dhcp_option_code_t codes[], unsigned codes_count)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(!self){
|
||||
goto bail;
|
||||
}
|
||||
if(codes_count){
|
||||
unsigned i;
|
||||
|
||||
tnet_dhcp_option_paramslist_t* option = (tnet_dhcp_option_paramslist_t*)tnet_dhcp_message_find_option(self, dhcp_code_Parameter_List);
|
||||
if(!option){
|
||||
tnet_dhcp_option_paramslist_t *option_paramslist = TNET_DHCP_OPTION_PARAMSLIST_CREATE();
|
||||
option = option_paramslist;
|
||||
tsk_list_push_back_data(self->options, (void**)&option_paramslist);
|
||||
}
|
||||
|
||||
for(i=0; i<codes_count; i++){
|
||||
if((ret = tnet_dhcp_option_paramslist_add_code(option, codes[i]))){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// [[DHCP MESSAGE]] object definition
|
||||
//
|
||||
|
|
|
@ -1,224 +1,226 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp_message.h
|
||||
* @brief DHCP Message as per RFC 2131 subclause 2.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#ifndef TNET_DHCP_MESSAGE_H
|
||||
#define TNET_DHCP_MESSAGE_H
|
||||
|
||||
#include "tinyNET_config.h"
|
||||
|
||||
#include "tnet_dhcp_option.h"
|
||||
#include "tnet_hardwares.h"
|
||||
|
||||
#include "tsk_buffer.h"
|
||||
|
||||
TNET_BEGIN_DECLS
|
||||
|
||||
#define TNET_DHCP_MESSAGE_CREATE(opcode) tsk_object_new(tnet_dhcp_message_def_t, (tnet_dhcp_message_op_t)opcode)
|
||||
#define TNET_DHCP_REQUEST_CREATE() TNET_DHCP_MESSAGE_CREATE(dhcp_op_bootrequest)
|
||||
#define TNET_DHCP_REPLY_CREATE() TNET_DHCP_MESSAGE_CREATE(dhcp_op_bootreply)
|
||||
|
||||
#define TNET_DHCP_MESSAGE_IS_REQUEST(self) ((self) && ((self)->op==dhcp_op_bootrequest))
|
||||
#define TNET_DHCP_MESSAGE_IS_REPLY(self) ((self) && ((self)->op==dhcp_op_bootreply))
|
||||
|
||||
#define TNET_DHCP_MAGIC_COOKIE 0x63825363 /**< DHCP magic cookie (99, 130, 83 and 99 in decimal).*/
|
||||
|
||||
#define TNET_DHCP_MESSAGE_MIN_SIZE 223 /* Is it rigth? */
|
||||
|
||||
/** List of all supported DHCP message (see RFC 2131).
|
||||
*/
|
||||
typedef enum tnet_dhcp_message_type_e
|
||||
{
|
||||
/**< DHCPDISCOVER - Client broadcast to locate available servers.
|
||||
*/
|
||||
dhcp_type_discover = 1,
|
||||
|
||||
/**< DHCPOFFER - Server to client in response to DHCPDISCOVER with
|
||||
offer of configuration parameters.
|
||||
*/
|
||||
dhcp_type_offer = 2,
|
||||
|
||||
/**< DHCPREQUEST - Client message to servers either (a) requesting
|
||||
offered parameters from one server and implicitly
|
||||
declining offers from all others, (b) confirming
|
||||
correctness of previously allocated address after,
|
||||
e.g., system reboot, or (c) extending the lease on a
|
||||
particular network address.
|
||||
*/
|
||||
dhcp_type_request = 3,
|
||||
|
||||
/**< DHCPDECLINE - Client to server indicating network address is already
|
||||
in use.
|
||||
*/
|
||||
dhcp_type_decline = 4,
|
||||
|
||||
/**< DHCPACK - Server to client with configuration parameters,
|
||||
including committed network address.
|
||||
*/
|
||||
dhcp_type_ack = 5,
|
||||
|
||||
/**< DHCPNAK - Server to client indicating client's notion of network
|
||||
address is incorrect (e.g., client has moved to new
|
||||
subnet) or client's lease as expired
|
||||
*/
|
||||
dhcp_type_nack = 6,
|
||||
|
||||
/**< DHCPRELEASE - Client to server relinquishing network address and
|
||||
cancelling remaining lease.
|
||||
*/
|
||||
dhcp_type_release = 7,
|
||||
|
||||
/**< DHCPINFORM - Client to server, asking only for local configuration
|
||||
parameters; client already has externally configured
|
||||
network address.
|
||||
*/
|
||||
dhcp_type_inform = 8,
|
||||
}
|
||||
tnet_dhcp_message_type_t;
|
||||
|
||||
/** DHCP message OP code / message type.
|
||||
*/
|
||||
typedef enum tnet_dhcp_message_op_e
|
||||
{
|
||||
dhcp_op_bootrequest = 1,
|
||||
dhcp_op_bootreply = 2
|
||||
}
|
||||
tnet_dhcp_message_op_t;
|
||||
|
||||
/** BOOTP/DHCP message as per RFC 2131 subclause 2.
|
||||
*/
|
||||
typedef struct tnet_dhcp_message_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
/**< DHCP message type. Mandatory.
|
||||
*/
|
||||
tnet_dhcp_message_type_t type;
|
||||
/*
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| op (1) | htype (1) | hlen (1) | hops (1) |
|
||||
+---------------+---------------+---------------+---------------+
|
||||
| xid (4) |
|
||||
+-------------------------------+-------------------------------+
|
||||
| secs (2) | flags (2) |
|
||||
+-------------------------------+-------------------------------+
|
||||
| ciaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| yiaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| siaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| giaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| chaddr (16) |
|
||||
| |
|
||||
| |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| sname (64) |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| file (128) |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| options (variable) |
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**< Message op code / message type (1-byte).
|
||||
1 = BOOTREQUEST, 2 = BOOTREPLY
|
||||
*/
|
||||
tnet_dhcp_message_op_t op;
|
||||
/**< Hardware address type, see ARP section in "Assigned Numbers" RFC; e.g., '1' = 10mb ethernet.
|
||||
For more information see RFC 1340.
|
||||
*/
|
||||
tnet_hardware_type_t htype;
|
||||
/**< Hardware address length (e.g. '6' for 10mb ethernet). strlen(chaddr).
|
||||
*/
|
||||
uint8_t hlen;
|
||||
/**< Client sets to zero, optionally used by relay agents when booting via a relay agent.
|
||||
*/
|
||||
uint8_t hops;
|
||||
/**< Transaction ID, a random number chosen by the client, used by the client
|
||||
and server to associate messages and responses between a client and a server.
|
||||
*/
|
||||
uint32_t xid;
|
||||
/**< Filled in by client, seconds elapsed since client began address acquisition or renewal process.
|
||||
*/
|
||||
uint16_t secs;
|
||||
/**< Flags (see figure 2)
|
||||
*/
|
||||
uint16_t flags;
|
||||
/**< Client IP address; only filled in if client is in BOUND, RENEW or REBINDING
|
||||
state and can respond to ARP requests.
|
||||
*/
|
||||
uint32_t ciaddr;
|
||||
/**< 'your' (client) IP address.
|
||||
*/
|
||||
uint32_t yiaddr;
|
||||
/**< IP address of next server to use in bootstrap;
|
||||
returned in DHCPOFFER, DHCPACK by server.
|
||||
*/
|
||||
uint32_t siaddr;
|
||||
/**< Relay agent IP address, used in booting via a relay agent.
|
||||
*/
|
||||
uint32_t giaddr;
|
||||
/**< Client hardware address.
|
||||
*/
|
||||
uint8_t chaddr[16];
|
||||
/**< Optional server host name, null terminated string.
|
||||
*/
|
||||
uint8_t sname[64];
|
||||
/**<Boot file name, null terminated string; "generic" name or null in DHCPDISCOVER,
|
||||
fully qualifieddirectory-path name in DHCPOFFER.
|
||||
*/
|
||||
uint8_t file[128];
|
||||
/**Optional parameters field. See the options documents for a list of defined options.
|
||||
For more information please refer to RFC 2132, 1497 and 1533.
|
||||
*/
|
||||
tnet_dhcp_options_L_t *options;
|
||||
}
|
||||
tnet_dhcp_message_t;
|
||||
|
||||
typedef tsk_list_t tnet_dhcp_messages_L_t;
|
||||
typedef tnet_dhcp_message_t tnet_dhcp_request_t; /**< BOOTREQUEST message. */
|
||||
typedef tnet_dhcp_message_t tnet_dhcp_reply_t; /**< BOOTREPLY message. */
|
||||
|
||||
tsk_buffer_t* tnet_dhcp_message_serialize(const struct tnet_dhcp_ctx_s *ctx, const tnet_dhcp_message_t *self);
|
||||
tnet_dhcp_message_t* tnet_dhcp_message_deserialize(const struct tnet_dhcp_ctx_s *ctx, const uint8_t *data, size_t size);
|
||||
const tnet_dhcp_option_t* tnet_dhcp_message_find_option(const tnet_dhcp_message_t *self, tnet_dhcp_option_code_t code);
|
||||
int tnet_dhcp_message_add_codes(tnet_dhcp_message_t *self, tnet_dhcp_option_code_t codes[], unsigned codes_count);
|
||||
|
||||
TINYNET_GEXTERN const void *tnet_dhcp_message_def_t;
|
||||
|
||||
TNET_END_DECLS
|
||||
|
||||
#endif /* TNET_DHCP_MESSAGE_H */
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
/**@file tnet_dhcp_message.h
|
||||
* @brief DHCP Message as per RFC 2131 subclause 2.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#ifndef TNET_DHCP_MESSAGE_H
|
||||
#define TNET_DHCP_MESSAGE_H
|
||||
|
||||
#include "tinyNET_config.h"
|
||||
|
||||
#include "tnet_dhcp_option.h"
|
||||
#include "tnet_hardwares.h"
|
||||
|
||||
#include "tsk_buffer.h"
|
||||
|
||||
TNET_BEGIN_DECLS
|
||||
|
||||
struct tnet_dhcp_ctx_s;
|
||||
|
||||
#define TNET_DHCP_MESSAGE_CREATE(opcode) tsk_object_new(tnet_dhcp_message_def_t, (tnet_dhcp_message_op_t)opcode)
|
||||
#define TNET_DHCP_REQUEST_CREATE() TNET_DHCP_MESSAGE_CREATE(dhcp_op_bootrequest)
|
||||
#define TNET_DHCP_REPLY_CREATE() TNET_DHCP_MESSAGE_CREATE(dhcp_op_bootreply)
|
||||
|
||||
#define TNET_DHCP_MESSAGE_IS_REQUEST(self) ((self) && ((self)->op==dhcp_op_bootrequest))
|
||||
#define TNET_DHCP_MESSAGE_IS_REPLY(self) ((self) && ((self)->op==dhcp_op_bootreply))
|
||||
|
||||
#define TNET_DHCP_MAGIC_COOKIE 0x63825363 /**< DHCP magic cookie (99, 130, 83 and 99 in decimal).*/
|
||||
|
||||
#define TNET_DHCP_MESSAGE_MIN_SIZE 223 /* Is it rigth? */
|
||||
|
||||
/** List of all supported DHCP message (see RFC 2131).
|
||||
*/
|
||||
typedef enum tnet_dhcp_message_type_e
|
||||
{
|
||||
/**< DHCPDISCOVER - Client broadcast to locate available servers.
|
||||
*/
|
||||
dhcp_type_discover = 1,
|
||||
|
||||
/**< DHCPOFFER - Server to client in response to DHCPDISCOVER with
|
||||
offer of configuration parameters.
|
||||
*/
|
||||
dhcp_type_offer = 2,
|
||||
|
||||
/**< DHCPREQUEST - Client message to servers either (a) requesting
|
||||
offered parameters from one server and implicitly
|
||||
declining offers from all others, (b) confirming
|
||||
correctness of previously allocated address after,
|
||||
e.g., system reboot, or (c) extending the lease on a
|
||||
particular network address.
|
||||
*/
|
||||
dhcp_type_request = 3,
|
||||
|
||||
/**< DHCPDECLINE - Client to server indicating network address is already
|
||||
in use.
|
||||
*/
|
||||
dhcp_type_decline = 4,
|
||||
|
||||
/**< DHCPACK - Server to client with configuration parameters,
|
||||
including committed network address.
|
||||
*/
|
||||
dhcp_type_ack = 5,
|
||||
|
||||
/**< DHCPNAK - Server to client indicating client's notion of network
|
||||
address is incorrect (e.g., client has moved to new
|
||||
subnet) or client's lease as expired
|
||||
*/
|
||||
dhcp_type_nack = 6,
|
||||
|
||||
/**< DHCPRELEASE - Client to server relinquishing network address and
|
||||
cancelling remaining lease.
|
||||
*/
|
||||
dhcp_type_release = 7,
|
||||
|
||||
/**< DHCPINFORM - Client to server, asking only for local configuration
|
||||
parameters; client already has externally configured
|
||||
network address.
|
||||
*/
|
||||
dhcp_type_inform = 8,
|
||||
}
|
||||
tnet_dhcp_message_type_t;
|
||||
|
||||
/** DHCP message OP code / message type.
|
||||
*/
|
||||
typedef enum tnet_dhcp_message_op_e
|
||||
{
|
||||
dhcp_op_bootrequest = 1,
|
||||
dhcp_op_bootreply = 2
|
||||
}
|
||||
tnet_dhcp_message_op_t;
|
||||
|
||||
/** BOOTP/DHCP message as per RFC 2131 subclause 2.
|
||||
*/
|
||||
typedef struct tnet_dhcp_message_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
/**< DHCP message type. Mandatory.
|
||||
*/
|
||||
tnet_dhcp_message_type_t type;
|
||||
/*
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| op (1) | htype (1) | hlen (1) | hops (1) |
|
||||
+---------------+---------------+---------------+---------------+
|
||||
| xid (4) |
|
||||
+-------------------------------+-------------------------------+
|
||||
| secs (2) | flags (2) |
|
||||
+-------------------------------+-------------------------------+
|
||||
| ciaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| yiaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| siaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| giaddr (4) |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| chaddr (16) |
|
||||
| |
|
||||
| |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| sname (64) |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| file (128) |
|
||||
+---------------------------------------------------------------+
|
||||
| |
|
||||
| options (variable) |
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**< Message op code / message type (1-byte).
|
||||
1 = BOOTREQUEST, 2 = BOOTREPLY
|
||||
*/
|
||||
tnet_dhcp_message_op_t op;
|
||||
/**< Hardware address type, see ARP section in "Assigned Numbers" RFC; e.g., '1' = 10mb ethernet.
|
||||
For more information see RFC 1340.
|
||||
*/
|
||||
tnet_hardware_type_t htype;
|
||||
/**< Hardware address length (e.g. '6' for 10mb ethernet). strlen(chaddr).
|
||||
*/
|
||||
uint8_t hlen;
|
||||
/**< Client sets to zero, optionally used by relay agents when booting via a relay agent.
|
||||
*/
|
||||
uint8_t hops;
|
||||
/**< Transaction ID, a random number chosen by the client, used by the client
|
||||
and server to associate messages and responses between a client and a server.
|
||||
*/
|
||||
uint32_t xid;
|
||||
/**< Filled in by client, seconds elapsed since client began address acquisition or renewal process.
|
||||
*/
|
||||
uint16_t secs;
|
||||
/**< Flags (see figure 2)
|
||||
*/
|
||||
uint16_t flags;
|
||||
/**< Client IP address; only filled in if client is in BOUND, RENEW or REBINDING
|
||||
state and can respond to ARP requests.
|
||||
*/
|
||||
uint32_t ciaddr;
|
||||
/**< 'your' (client) IP address.
|
||||
*/
|
||||
uint32_t yiaddr;
|
||||
/**< IP address of next server to use in bootstrap;
|
||||
returned in DHCPOFFER, DHCPACK by server.
|
||||
*/
|
||||
uint32_t siaddr;
|
||||
/**< Relay agent IP address, used in booting via a relay agent.
|
||||
*/
|
||||
uint32_t giaddr;
|
||||
/**< Client hardware address.
|
||||
*/
|
||||
uint8_t chaddr[16];
|
||||
/**< Optional server host name, null terminated string.
|
||||
*/
|
||||
uint8_t sname[64];
|
||||
/**<Boot file name, null terminated string; "generic" name or null in DHCPDISCOVER,
|
||||
fully qualifieddirectory-path name in DHCPOFFER.
|
||||
*/
|
||||
uint8_t file[128];
|
||||
/**Optional parameters field. See the options documents for a list of defined options.
|
||||
For more information please refer to RFC 2132, 1497 and 1533.
|
||||
*/
|
||||
tnet_dhcp_options_L_t *options;
|
||||
}
|
||||
tnet_dhcp_message_t;
|
||||
|
||||
typedef tsk_list_t tnet_dhcp_messages_L_t;
|
||||
typedef tnet_dhcp_message_t tnet_dhcp_request_t; /**< BOOTREQUEST message. */
|
||||
typedef tnet_dhcp_message_t tnet_dhcp_reply_t; /**< BOOTREPLY message. */
|
||||
|
||||
tsk_buffer_t* tnet_dhcp_message_serialize(const struct tnet_dhcp_ctx_s *ctx, const tnet_dhcp_message_t *self);
|
||||
tnet_dhcp_message_t* tnet_dhcp_message_deserialize(const struct tnet_dhcp_ctx_s *ctx, const uint8_t *data, size_t size);
|
||||
const tnet_dhcp_option_t* tnet_dhcp_message_find_option(const tnet_dhcp_message_t *self, tnet_dhcp_option_code_t code);
|
||||
int tnet_dhcp_message_add_codes(tnet_dhcp_message_t *self, tnet_dhcp_option_code_t codes[], unsigned codes_count);
|
||||
|
||||
TINYNET_GEXTERN const void *tnet_dhcp_message_def_t;
|
||||
|
||||
TNET_END_DECLS
|
||||
|
||||
#endif /* TNET_DHCP_MESSAGE_H */
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "tsk_debug.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
tsk_buffer_t* tnet_dhcp6_message_serialize(const tnet_dhcp6_ctx_t *ctx, const tnet_dhcp6_message_t *self)
|
||||
{
|
||||
tsk_buffer_t* output = 0;
|
||||
|
@ -53,7 +55,7 @@ tsk_buffer_t* tnet_dhcp6_message_serialize(const tnet_dhcp6_ctx_t *ctx, const tn
|
|||
/*== Vendor class
|
||||
*/
|
||||
{
|
||||
_2bytes = htons(dhcp6_code_vendor_class);
|
||||
_2bytes = htons(dhcp6_code_vendor_class);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
_2bytes = htons(4 + strlen(ctx->vendor_class_data));
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
|
@ -86,38 +88,38 @@ tnet_dhcp6_message_t* tnet_dhcp6_message_deserialize(const tnet_dhcp6_ctx_t *ctx
|
|||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// [[DHCPv6 MESSAGE]] object definition
|
||||
//
|
||||
static void* tnet_dhcp6_message_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_dhcp6_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
static uint16_t __dhcp6message_unique_tid = 0;//(uint32_t)tsk_time_epoch();
|
||||
|
||||
message->type = va_arg(*app, tnet_dhcp6_message_type_t);
|
||||
message->transaction_id = ++__dhcp6message_unique_tid;
|
||||
message->options = TSK_LIST_CREATE();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_dhcp6_message_destroy(void * self)
|
||||
{
|
||||
tnet_dhcp6_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(message->options);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_dhcp6_message_def_s =
|
||||
{
|
||||
sizeof(tnet_dhcp6_message_t),
|
||||
tnet_dhcp6_message_create,
|
||||
tnet_dhcp6_message_destroy,
|
||||
0,
|
||||
};
|
||||
//=================================================================================================
|
||||
// [[DHCPv6 MESSAGE]] object definition
|
||||
//
|
||||
static void* tnet_dhcp6_message_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_dhcp6_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
static uint16_t __dhcp6message_unique_tid = 0;//(uint32_t)tsk_time_epoch();
|
||||
|
||||
message->type = va_arg(*app, tnet_dhcp6_message_type_t);
|
||||
message->transaction_id = ++__dhcp6message_unique_tid;
|
||||
message->options = TSK_LIST_CREATE();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_dhcp6_message_destroy(void * self)
|
||||
{
|
||||
tnet_dhcp6_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(message->options);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_dhcp6_message_def_s =
|
||||
{
|
||||
sizeof(tnet_dhcp6_message_t),
|
||||
tnet_dhcp6_message_create,
|
||||
tnet_dhcp6_message_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_dhcp6_message_def_t = &tnet_dhcp6_message_def_s;
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
TNET_BEGIN_DECLS
|
||||
|
||||
struct tnet_dhcp6_ctx_s;
|
||||
|
||||
#define TNET_DHCP6_MESSAGE_CREATE(type) tsk_object_new(tnet_dhcp6_message_def_t, (tnet_dhcp6_message_type_t)type)
|
||||
#define TNET_DHCP6_REQUEST_CREATE(type) TNET_DHCP6_MESSAGE_CREATE(type)
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ tnet_dhcp6_option_t* tnet_dhcp6_option_deserialize(const void* data, size_t size
|
|||
{
|
||||
tnet_dhcp6_option_t *option = 0;
|
||||
uint8_t* dataPtr = ((uint8_t*)data);
|
||||
uint8_t* dataEnd = (dataPtr+size);
|
||||
//uint8_t* dataEnd = (dataPtr+size);
|
||||
|
||||
tnet_dhcp6_option_code_t code;
|
||||
uint16_t len;
|
||||
|
@ -106,15 +106,15 @@ int tnet_dhcp6_option_serialize(const tnet_dhcp6_option_t* self, tsk_buffer_t *o
|
|||
uint16_t _2bytes;
|
||||
int ret = -1;
|
||||
|
||||
if(!self || !output){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*== Code
|
||||
*/
|
||||
_2bytes = htons(self->code);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
|
||||
if(!self || !output){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*== Code
|
||||
*/
|
||||
_2bytes = htons(self->code);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
|
||||
switch(self->code)
|
||||
{
|
||||
case dhcp6_code_clientid:
|
||||
|
@ -129,7 +129,7 @@ int tnet_dhcp6_option_serialize(const tnet_dhcp6_option_t* self, tsk_buffer_t *o
|
|||
if(self->data && self->data->size)
|
||||
{
|
||||
/* option-len */
|
||||
_2bytes = htons(self->data->size);
|
||||
_2bytes = htons(self->data->size);
|
||||
tsk_buffer_append(output, &(_2bytes), 2);
|
||||
/* option-data */
|
||||
ret = tsk_buffer_append(output, self->data->data, self->data->size);
|
||||
|
|
|
@ -176,8 +176,6 @@ typedef tnet_dhcp6_option_identifier_t tnet_dhcp6_option_serverid_t;
|
|||
* RFC 3315 - 22.7. Option Request Option
|
||||
*=======================================================================================*/
|
||||
|
||||
TINYNET_API int tnet_dhcp6_option_orequest_add_code(struct tnet_dhcp6_option_orequest_s* self, uint16_t code);
|
||||
|
||||
/** DHCPv6 Option Request Option (subclause 22.7).
|
||||
*/
|
||||
typedef struct tnet_dhcp6_option_orequest_s
|
||||
|
@ -197,6 +195,8 @@ typedef struct tnet_dhcp6_option_orequest_s
|
|||
}
|
||||
tnet_dhcp6_option_orequest_t;
|
||||
|
||||
TINYNET_API int tnet_dhcp6_option_orequest_add_code(tnet_dhcp6_option_orequest_t* self, uint16_t code);
|
||||
|
||||
/*======================================================================================
|
||||
* RFC 3315 - 22.16. Vendor Class Option
|
||||
*=======================================================================================*/
|
||||
|
|
|
@ -331,7 +331,7 @@ int tnet_dns_query_naptr_srv(tnet_dns_ctx_t *ctx, const char* domain, const char
|
|||
|
||||
TSK_OBJECT_SAFE_FREE(response);
|
||||
|
||||
return (hostname && !tsk_strempty(*hostname)) ? 0 : -2;
|
||||
return (hostname && *hostname && !tsk_strempty(*hostname)) ? 0 : -2;
|
||||
}
|
||||
|
||||
int tnet_dns_cache_maintenance(tnet_dns_ctx_t *ctx)
|
||||
|
|
|
@ -125,8 +125,8 @@ typedef struct tnet_stun_binding_s
|
|||
tnet_stun_attribute_mapped_addr_t *maddr;
|
||||
//! XORed server reflexive address (STUN2 as per RFC 5389).
|
||||
tnet_stun_attribute_xmapped_addr_t *xmaddr;
|
||||
}
|
||||
tnet_stun_binding_t;
|
||||
}tnet_stun_binding_t;
|
||||
|
||||
TINYNET_GEXTERN const void *tnet_stun_binding_def_t;
|
||||
/**
|
||||
* @typedef tsk_list_t tnet_stun_bindings_L_t
|
||||
|
|
|
@ -1,437 +1,439 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tnet_stun_message.c
|
||||
* @brief STUN2 (RFC 5389) message parser.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tnet_stun_message.h"
|
||||
|
||||
#include "tnet_stun.h"
|
||||
|
||||
#include "../tnet_types.h"
|
||||
#include "../turn/tnet_turn_attribute.h"
|
||||
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_hmac.h"
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_ppfcs32.h"
|
||||
|
||||
#define SERIALIZE_N_ADD_ATTRIBUTE(ATT_NAME, payload, payload_size) \
|
||||
attribute = TNET_STUN_ATTRIBUTE_##ATT_NAME##_CREATE(payload, payload_size); \
|
||||
tnet_stun_attribute_serialize(attribute, output); \
|
||||
tnet_stun_attribute_pad(attribute, output); \
|
||||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
|
||||
//int tnet_stun_message_set_type(tnet_stun_message_t *message, tnet_stun_message_type_t type)
|
||||
//{
|
||||
// tnet_stun_message_t* msg = message;
|
||||
// if(message)
|
||||
// {
|
||||
// msg->type = type;
|
||||
// return 0;
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
//int tnet_stun_message_set_random_transacid(tnet_stun_message_handle_t *message)
|
||||
//{
|
||||
// tnet_stun_message_t* msg = message;
|
||||
// if(msg)
|
||||
// {
|
||||
// tsk_istr_t random;
|
||||
// tsk_md5digest_t digest;
|
||||
//
|
||||
// tsk_strrandom(&random);
|
||||
// TSK_MD5_DIGEST_CALC(random, sizeof(random), digest);
|
||||
//
|
||||
// memcpy(msg->transaction_id, digest, TNET_STUN_TRANSACID_SIZE);
|
||||
// return 0;
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fn tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
||||
*
|
||||
* @brief Serialize a STUN message into binary data.
|
||||
*
|
||||
* @author Mamadou
|
||||
* @date 1/14/2010
|
||||
*
|
||||
* @param [in,out] self The STUN message to serialize.
|
||||
*
|
||||
* @return A buffer holding the binary data (result) if serialization succeed and zero otherwise.
|
||||
* It is up to the caller of this method to free the returned buffer using @ref TSK_BUFFER_SAFE_FREE.
|
||||
**/
|
||||
tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
||||
{
|
||||
tsk_buffer_t *output = 0;
|
||||
tnet_stun_attribute_t *attribute;
|
||||
unsigned compute_integrity = self->integrity;
|
||||
|
||||
if(!self) goto bail;
|
||||
|
||||
output = TSK_BUFFER_CREATE_NULL();
|
||||
|
||||
/* RFC 5389 - 6. STUN Message Structure
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|0 0| STUN Message Type | Message Length |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Magic Cookie |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| |
|
||||
| Transaction ID (96 bits) |
|
||||
| |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
/* STUN Message Type
|
||||
*/
|
||||
{
|
||||
uint16_t type = htons(self->type);
|
||||
tsk_buffer_append(output, &(type), 2);
|
||||
}
|
||||
|
||||
/* Message Length ==> Will be updated after attributes have been added. */
|
||||
{
|
||||
uint16_t length = 0;
|
||||
tsk_buffer_append(output, &(length), 2);
|
||||
}
|
||||
|
||||
/* Magic Cookie
|
||||
*/
|
||||
{
|
||||
uint32_t cookie = htonl(self->cookie);
|
||||
tsk_buffer_append(output, &(cookie), 4);
|
||||
}
|
||||
|
||||
|
||||
/* Transaction ID (96 bits==>16bytes)
|
||||
*/
|
||||
tsk_buffer_append(output, self->transaction_id, TNET_STUN_TRANSACID_SIZE);
|
||||
|
||||
/* DONT-FRAGMENT
|
||||
*/
|
||||
if(self->dontfrag)
|
||||
{
|
||||
attribute = TNET_TURN_ATTRIBUTE_DONTFRAG_CREATE();
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
}
|
||||
|
||||
/*=== Attributes ===
|
||||
*/
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tsk_list_foreach(item, self->attributes)
|
||||
{
|
||||
attribute = item->data;
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
tnet_stun_attribute_pad(attribute, output);
|
||||
}
|
||||
}
|
||||
|
||||
/* AUTHENTICATION */
|
||||
if(self->realm && self->nonce)
|
||||
{
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(USERNAME, self->username, strlen(self->username));
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(REALM, self->realm, strlen(self->realm));
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(NONCE, self->nonce, strlen(self->nonce));
|
||||
|
||||
compute_integrity = 1;
|
||||
}
|
||||
|
||||
/* Message Length: The message length MUST contain the size, in bytes, of the message
|
||||
not including the 20-byte STUN header.
|
||||
*/
|
||||
{
|
||||
uint16_t length = (output->size) - TNET_STUN_HEADER_SIZE;
|
||||
if(self->fingerprint)
|
||||
length += (2/* Type */ + 2 /* Length */+ 4 /* FINGERPRINT VALUE*/);
|
||||
|
||||
if(compute_integrity)
|
||||
length += (2/* Type */ + 2 /* Length */+ TSK_SHA1_DIGEST_SIZE /* INTEGRITY VALUE*/);
|
||||
|
||||
*(((uint16_t*)output->data)+1) = htons(length);
|
||||
}
|
||||
|
||||
/* MESSAGE-INTEGRITY */
|
||||
if(compute_integrity)
|
||||
{
|
||||
/* RFC 5389 - 15.4. MESSAGE-INTEGRITY
|
||||
The MESSAGE-INTEGRITY attribute contains an HMAC-SHA1 [RFC2104] of the STUN message.
|
||||
|
||||
For long-term credentials ==> key = MD5(username ":" realm ":" SASLprep(password))
|
||||
For short-term credentials ==> key = SASLprep(password)
|
||||
FIXME: what about short term credentials?
|
||||
FIXME: what about SASLprep
|
||||
*/
|
||||
char* keystr = 0;
|
||||
tsk_sha1digest_t hmac;
|
||||
tsk_md5digest_t md5;
|
||||
|
||||
tsk_sprintf(&keystr, "%s:%s:%s", self->username, self->realm, self->password);
|
||||
TSK_MD5_DIGEST_CALC(keystr, strlen(keystr), md5);
|
||||
hmac_sha1digest_compute(output->data, output->size, (const char*)md5, TSK_MD5_DIGEST_SIZE, hmac);
|
||||
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(INTEGRITY, hmac, TSK_SHA1_DIGEST_SIZE);
|
||||
|
||||
TSK_FREE(keystr);
|
||||
}
|
||||
|
||||
/* FINGERPRINT */
|
||||
if(self->fingerprint)
|
||||
{
|
||||
/* RFC 5389 - 15.5. FINGERPRINT
|
||||
The FINGERPRINT attribute MAY be present in all STUN messages. The
|
||||
value of the attribute is computed as the CRC-32 of the STUN message
|
||||
up to (but excluding) the FINGERPRINT attribute itself, XOR'ed with
|
||||
the 32-bit value 0x5354554e
|
||||
*/
|
||||
uint32_t fingerprint = tsk_pppfcs32(TSK_PPPINITFCS32, output->data, output->size);
|
||||
fingerprint ^= 0x5354554e;
|
||||
fingerprint = htonl(fingerprint);
|
||||
|
||||
attribute = TNET_STUN_ATTRIBUTE_FINGERPRINT_CREATE(fingerprint);
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
}
|
||||
|
||||
bail:
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @fn tnet_stun_message_t message* tnet_stun_message_deserialize(const uint8_t *data,
|
||||
* size_t size)
|
||||
*
|
||||
* @brief Deserialize a STUN message from binary data.
|
||||
*
|
||||
* @author Mamadou
|
||||
* @date 1/14/2010
|
||||
*
|
||||
* @param [in,out] data A pointer to the binary data.
|
||||
* @param size The size of the binary data.
|
||||
*
|
||||
* @return A STUN message if deserialization succeed and zero otherwise.
|
||||
**/
|
||||
tnet_stun_message_t* tnet_stun_message_deserialize(const uint8_t *data, size_t size)
|
||||
{
|
||||
tnet_stun_message_t *message = 0;
|
||||
uint8_t* dataPtr, *dataEnd;
|
||||
|
||||
|
||||
if(!data || (size < TNET_STUN_HEADER_SIZE) || !TNET_IS_STUN2(data))
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dataPtr = (uint8_t*)data;
|
||||
dataEnd = (dataPtr + size);
|
||||
|
||||
message = TNET_STUN_MESSAGE_CREATE_NULL();
|
||||
|
||||
/* Message Type
|
||||
*/
|
||||
message->type = (tnet_stun_message_type_t)ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
|
||||
/* Message Length
|
||||
*/
|
||||
message->length = ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
|
||||
/* Check message validity
|
||||
*/
|
||||
if((message->length + TNET_STUN_HEADER_SIZE) != size)
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(message);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Magic Cookie
|
||||
==> already set by the constructor and checked by @ref TNET_IS_STUN2
|
||||
*/
|
||||
dataPtr += 4;
|
||||
|
||||
/* Transaction ID
|
||||
*/
|
||||
memcpy(message->transaction_id, dataPtr, TNET_STUN_TRANSACID_SIZE);
|
||||
dataPtr += TNET_STUN_TRANSACID_SIZE;
|
||||
|
||||
/* == Parse attributes
|
||||
*/
|
||||
while(dataPtr < dataEnd)
|
||||
{
|
||||
tnet_stun_attribute_t *attribute = tnet_stun_attribute_deserialize(dataPtr, (dataEnd - dataPtr));
|
||||
if(attribute)
|
||||
{
|
||||
size_t att_size = (attribute->length + 2 /* Type*/ + 2/* Length */);
|
||||
att_size += (att_size%4) ? 4-(att_size%4) : 0; // Skip zero bytes used to pad the attribute.
|
||||
|
||||
dataPtr += att_size;
|
||||
tsk_list_push_back_data(message->attributes, (void**)&attribute);
|
||||
|
||||
continue;
|
||||
}
|
||||
else continue;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bail:
|
||||
return message;
|
||||
}
|
||||
|
||||
int tnet_stun_message_add_attribute(tnet_stun_message_t *self, tnet_stun_attribute_t** attribute)
|
||||
{
|
||||
//if(self && attribute)
|
||||
{
|
||||
tsk_list_push_back_data(self->attributes, (void**)attribute);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const tnet_stun_attribute_t* tnet_stun_message_get_attribute(const tnet_stun_message_t *self, tnet_stun_attribute_type_t type)
|
||||
{
|
||||
tnet_stun_attribute_t* attribute;
|
||||
|
||||
if(self && !TSK_LIST_IS_EMPTY(self->attributes))
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tsk_list_foreach(item, self->attributes)
|
||||
{
|
||||
if((attribute = item->data) && attribute->type == type)
|
||||
{
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
short tnet_stun_message_get_errorcode(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_stun_attribute_errorcode_t* error = (const tnet_stun_attribute_errorcode_t*)tnet_stun_message_get_attribute(self, stun_error_code);
|
||||
if(error)
|
||||
{
|
||||
return ((error->_class*100) + error->number);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* tnet_stun_message_get_realm(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_stun_attribute_realm_t* realm = (const tnet_stun_attribute_realm_t*)tnet_stun_message_get_attribute(self, stun_realm);
|
||||
if(realm)
|
||||
{
|
||||
return realm->value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* tnet_stun_message_get_nonce(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_stun_attribute_nonce_t* nonce = (const tnet_stun_attribute_nonce_t*)tnet_stun_message_get_attribute(self, stun_nonce);
|
||||
if(nonce)
|
||||
{
|
||||
return nonce->value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tnet_stun_message_get_lifetime(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_turn_attribute_lifetime_t* lifetime = (const tnet_turn_attribute_lifetime_t*)tnet_stun_message_get_attribute(self, stun_lifetime);
|
||||
if(lifetime)
|
||||
{
|
||||
return lifetime->value;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// STUN2 MESSAGE object definition
|
||||
//
|
||||
static void* tnet_stun_message_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_stun_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
message->username = tsk_strdup(va_arg(*app, const char*));
|
||||
message->password = tsk_strdup(va_arg(*app, const char*));
|
||||
|
||||
message->cookie = TNET_STUN_MAGIC_COOKIE;
|
||||
message->attributes = TSK_LIST_CREATE();
|
||||
|
||||
message->fingerprint = 1;
|
||||
message->integrity = 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_stun_message_destroy(void * self)
|
||||
{
|
||||
tnet_stun_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
TSK_FREE(message->username);
|
||||
TSK_FREE(message->password);
|
||||
TSK_FREE(message->realm);
|
||||
TSK_FREE(message->nonce);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message->attributes);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_stun_message_def_s =
|
||||
{
|
||||
sizeof(tnet_stun_message_t),
|
||||
tnet_stun_message_create,
|
||||
tnet_stun_message_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_stun_message_def_t = &tnet_stun_message_def_s;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tnet_stun_message.c
|
||||
* @brief STUN2 (RFC 5389) message parser.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tnet_stun_message.h"
|
||||
|
||||
#include "tnet_stun.h"
|
||||
|
||||
#include "../tnet_types.h"
|
||||
#include "../turn/tnet_turn_attribute.h"
|
||||
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_hmac.h"
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_ppfcs32.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define SERIALIZE_N_ADD_ATTRIBUTE(ATT_NAME, payload, payload_size) \
|
||||
attribute = TNET_STUN_ATTRIBUTE_##ATT_NAME##_CREATE(payload, payload_size); \
|
||||
tnet_stun_attribute_serialize(attribute, output); \
|
||||
tnet_stun_attribute_pad(attribute, output); \
|
||||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
|
||||
//int tnet_stun_message_set_type(tnet_stun_message_t *message, tnet_stun_message_type_t type)
|
||||
//{
|
||||
// tnet_stun_message_t* msg = message;
|
||||
// if(message)
|
||||
// {
|
||||
// msg->type = type;
|
||||
// return 0;
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
//int tnet_stun_message_set_random_transacid(tnet_stun_message_handle_t *message)
|
||||
//{
|
||||
// tnet_stun_message_t* msg = message;
|
||||
// if(msg)
|
||||
// {
|
||||
// tsk_istr_t random;
|
||||
// tsk_md5digest_t digest;
|
||||
//
|
||||
// tsk_strrandom(&random);
|
||||
// TSK_MD5_DIGEST_CALC(random, sizeof(random), digest);
|
||||
//
|
||||
// memcpy(msg->transaction_id, digest, TNET_STUN_TRANSACID_SIZE);
|
||||
// return 0;
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fn tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
||||
*
|
||||
* @brief Serialize a STUN message into binary data.
|
||||
*
|
||||
* @author Mamadou
|
||||
* @date 1/14/2010
|
||||
*
|
||||
* @param [in,out] self The STUN message to serialize.
|
||||
*
|
||||
* @return A buffer holding the binary data (result) if serialization succeed and zero otherwise.
|
||||
* It is up to the caller of this method to free the returned buffer using @ref TSK_BUFFER_SAFE_FREE.
|
||||
**/
|
||||
tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
||||
{
|
||||
tsk_buffer_t *output = 0;
|
||||
tnet_stun_attribute_t *attribute;
|
||||
unsigned compute_integrity = self->integrity;
|
||||
|
||||
if(!self) goto bail;
|
||||
|
||||
output = TSK_BUFFER_CREATE_NULL();
|
||||
|
||||
/* RFC 5389 - 6. STUN Message Structure
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|0 0| STUN Message Type | Message Length |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Magic Cookie |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| |
|
||||
| Transaction ID (96 bits) |
|
||||
| |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
/* STUN Message Type
|
||||
*/
|
||||
{
|
||||
uint16_t type = htons(self->type);
|
||||
tsk_buffer_append(output, &(type), 2);
|
||||
}
|
||||
|
||||
/* Message Length ==> Will be updated after attributes have been added. */
|
||||
{
|
||||
uint16_t length = 0;
|
||||
tsk_buffer_append(output, &(length), 2);
|
||||
}
|
||||
|
||||
/* Magic Cookie
|
||||
*/
|
||||
{
|
||||
uint32_t cookie = htonl(self->cookie);
|
||||
tsk_buffer_append(output, &(cookie), 4);
|
||||
}
|
||||
|
||||
|
||||
/* Transaction ID (96 bits==>16bytes)
|
||||
*/
|
||||
tsk_buffer_append(output, self->transaction_id, TNET_STUN_TRANSACID_SIZE);
|
||||
|
||||
/* DONT-FRAGMENT
|
||||
*/
|
||||
if(self->dontfrag)
|
||||
{
|
||||
attribute = TNET_TURN_ATTRIBUTE_DONTFRAG_CREATE();
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
}
|
||||
|
||||
/*=== Attributes ===
|
||||
*/
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tsk_list_foreach(item, self->attributes)
|
||||
{
|
||||
attribute = item->data;
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
tnet_stun_attribute_pad(attribute, output);
|
||||
}
|
||||
}
|
||||
|
||||
/* AUTHENTICATION */
|
||||
if(self->realm && self->nonce)
|
||||
{
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(USERNAME, self->username, strlen(self->username));
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(REALM, self->realm, strlen(self->realm));
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(NONCE, self->nonce, strlen(self->nonce));
|
||||
|
||||
compute_integrity = 1;
|
||||
}
|
||||
|
||||
/* Message Length: The message length MUST contain the size, in bytes, of the message
|
||||
not including the 20-byte STUN header.
|
||||
*/
|
||||
{
|
||||
uint16_t length = (output->size) - TNET_STUN_HEADER_SIZE;
|
||||
if(self->fingerprint)
|
||||
length += (2/* Type */ + 2 /* Length */+ 4 /* FINGERPRINT VALUE*/);
|
||||
|
||||
if(compute_integrity)
|
||||
length += (2/* Type */ + 2 /* Length */+ TSK_SHA1_DIGEST_SIZE /* INTEGRITY VALUE*/);
|
||||
|
||||
*(((uint16_t*)output->data)+1) = htons(length);
|
||||
}
|
||||
|
||||
/* MESSAGE-INTEGRITY */
|
||||
if(compute_integrity)
|
||||
{
|
||||
/* RFC 5389 - 15.4. MESSAGE-INTEGRITY
|
||||
The MESSAGE-INTEGRITY attribute contains an HMAC-SHA1 [RFC2104] of the STUN message.
|
||||
|
||||
For long-term credentials ==> key = MD5(username ":" realm ":" SASLprep(password))
|
||||
For short-term credentials ==> key = SASLprep(password)
|
||||
FIXME: what about short term credentials?
|
||||
FIXME: what about SASLprep
|
||||
*/
|
||||
char* keystr = 0;
|
||||
tsk_sha1digest_t hmac;
|
||||
tsk_md5digest_t md5;
|
||||
|
||||
tsk_sprintf(&keystr, "%s:%s:%s", self->username, self->realm, self->password);
|
||||
TSK_MD5_DIGEST_CALC(keystr, strlen(keystr), md5);
|
||||
hmac_sha1digest_compute(output->data, output->size, (const char*)md5, TSK_MD5_DIGEST_SIZE, hmac);
|
||||
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(INTEGRITY, hmac, TSK_SHA1_DIGEST_SIZE);
|
||||
|
||||
TSK_FREE(keystr);
|
||||
}
|
||||
|
||||
/* FINGERPRINT */
|
||||
if(self->fingerprint)
|
||||
{
|
||||
/* RFC 5389 - 15.5. FINGERPRINT
|
||||
The FINGERPRINT attribute MAY be present in all STUN messages. The
|
||||
value of the attribute is computed as the CRC-32 of the STUN message
|
||||
up to (but excluding) the FINGERPRINT attribute itself, XOR'ed with
|
||||
the 32-bit value 0x5354554e
|
||||
*/
|
||||
uint32_t fingerprint = tsk_pppfcs32(TSK_PPPINITFCS32, output->data, output->size);
|
||||
fingerprint ^= 0x5354554e;
|
||||
fingerprint = htonl(fingerprint);
|
||||
|
||||
attribute = TNET_STUN_ATTRIBUTE_FINGERPRINT_CREATE(fingerprint);
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
}
|
||||
|
||||
bail:
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @fn tnet_stun_message_t message* tnet_stun_message_deserialize(const uint8_t *data,
|
||||
* size_t size)
|
||||
*
|
||||
* @brief Deserialize a STUN message from binary data.
|
||||
*
|
||||
* @author Mamadou
|
||||
* @date 1/14/2010
|
||||
*
|
||||
* @param [in,out] data A pointer to the binary data.
|
||||
* @param size The size of the binary data.
|
||||
*
|
||||
* @return A STUN message if deserialization succeed and zero otherwise.
|
||||
**/
|
||||
tnet_stun_message_t* tnet_stun_message_deserialize(const uint8_t *data, size_t size)
|
||||
{
|
||||
tnet_stun_message_t *message = 0;
|
||||
uint8_t* dataPtr, *dataEnd;
|
||||
|
||||
|
||||
if(!data || (size < TNET_STUN_HEADER_SIZE) || !TNET_IS_STUN2(data))
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dataPtr = (uint8_t*)data;
|
||||
dataEnd = (dataPtr + size);
|
||||
|
||||
message = TNET_STUN_MESSAGE_CREATE_NULL();
|
||||
|
||||
/* Message Type
|
||||
*/
|
||||
message->type = (tnet_stun_message_type_t)ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
|
||||
/* Message Length
|
||||
*/
|
||||
message->length = ntohs(*((uint16_t*)dataPtr));
|
||||
dataPtr += 2;
|
||||
|
||||
/* Check message validity
|
||||
*/
|
||||
if((message->length + TNET_STUN_HEADER_SIZE) != size)
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(message);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Magic Cookie
|
||||
==> already set by the constructor and checked by @ref TNET_IS_STUN2
|
||||
*/
|
||||
dataPtr += 4;
|
||||
|
||||
/* Transaction ID
|
||||
*/
|
||||
memcpy(message->transaction_id, dataPtr, TNET_STUN_TRANSACID_SIZE);
|
||||
dataPtr += TNET_STUN_TRANSACID_SIZE;
|
||||
|
||||
/* == Parse attributes
|
||||
*/
|
||||
while(dataPtr < dataEnd)
|
||||
{
|
||||
tnet_stun_attribute_t *attribute = tnet_stun_attribute_deserialize(dataPtr, (dataEnd - dataPtr));
|
||||
if(attribute)
|
||||
{
|
||||
size_t att_size = (attribute->length + 2 /* Type*/ + 2/* Length */);
|
||||
att_size += (att_size%4) ? 4-(att_size%4) : 0; // Skip zero bytes used to pad the attribute.
|
||||
|
||||
dataPtr += att_size;
|
||||
tsk_list_push_back_data(message->attributes, (void**)&attribute);
|
||||
|
||||
continue;
|
||||
}
|
||||
else continue;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bail:
|
||||
return message;
|
||||
}
|
||||
|
||||
int tnet_stun_message_add_attribute(tnet_stun_message_t *self, tnet_stun_attribute_t** attribute)
|
||||
{
|
||||
//if(self && attribute)
|
||||
{
|
||||
tsk_list_push_back_data(self->attributes, (void**)attribute);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const tnet_stun_attribute_t* tnet_stun_message_get_attribute(const tnet_stun_message_t *self, tnet_stun_attribute_type_t type)
|
||||
{
|
||||
tnet_stun_attribute_t* attribute;
|
||||
|
||||
if(self && !TSK_LIST_IS_EMPTY(self->attributes))
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tsk_list_foreach(item, self->attributes)
|
||||
{
|
||||
if((attribute = item->data) && attribute->type == type)
|
||||
{
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
short tnet_stun_message_get_errorcode(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_stun_attribute_errorcode_t* error = (const tnet_stun_attribute_errorcode_t*)tnet_stun_message_get_attribute(self, stun_error_code);
|
||||
if(error)
|
||||
{
|
||||
return ((error->_class*100) + error->number);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* tnet_stun_message_get_realm(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_stun_attribute_realm_t* realm = (const tnet_stun_attribute_realm_t*)tnet_stun_message_get_attribute(self, stun_realm);
|
||||
if(realm)
|
||||
{
|
||||
return realm->value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* tnet_stun_message_get_nonce(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_stun_attribute_nonce_t* nonce = (const tnet_stun_attribute_nonce_t*)tnet_stun_message_get_attribute(self, stun_nonce);
|
||||
if(nonce)
|
||||
{
|
||||
return nonce->value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tnet_stun_message_get_lifetime(const tnet_stun_message_t *self)
|
||||
{
|
||||
const tnet_turn_attribute_lifetime_t* lifetime = (const tnet_turn_attribute_lifetime_t*)tnet_stun_message_get_attribute(self, stun_lifetime);
|
||||
if(lifetime)
|
||||
{
|
||||
return lifetime->value;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// STUN2 MESSAGE object definition
|
||||
//
|
||||
static void* tnet_stun_message_create(void * self, va_list * app)
|
||||
{
|
||||
tnet_stun_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
message->username = tsk_strdup(va_arg(*app, const char*));
|
||||
message->password = tsk_strdup(va_arg(*app, const char*));
|
||||
|
||||
message->cookie = TNET_STUN_MAGIC_COOKIE;
|
||||
message->attributes = TSK_LIST_CREATE();
|
||||
|
||||
message->fingerprint = 1;
|
||||
message->integrity = 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tnet_stun_message_destroy(void * self)
|
||||
{
|
||||
tnet_stun_message_t *message = self;
|
||||
if(message)
|
||||
{
|
||||
TSK_FREE(message->username);
|
||||
TSK_FREE(message->password);
|
||||
TSK_FREE(message->realm);
|
||||
TSK_FREE(message->nonce);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message->attributes);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tnet_stun_message_def_s =
|
||||
{
|
||||
sizeof(tnet_stun_message_t),
|
||||
tnet_stun_message_create,
|
||||
tnet_stun_message_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_stun_message_def_t = &tnet_stun_message_def_s;
|
||||
|
||||
|
|
|
@ -1,114 +1,116 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tinyNET_config.h
|
||||
* @brief Global configuration file.
|
||||
*
|
||||
* This file incude all your preferences or configuration. All specific configuration
|
||||
* must be defined in this file. You must include this file in all your header files.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#ifndef _TINYNET_H_
|
||||
#define _TINYNET_H_
|
||||
|
||||
#ifdef 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 TNET_UNDER_WINDOWS 1
|
||||
#endif
|
||||
|
||||
/**@def TINYNET_API
|
||||
* Used on Windows and Sysbian systems to export public functions.
|
||||
*/
|
||||
#if !defined(__GNUC__) && defined(TINYNET_EXPORTS)
|
||||
# define TINYNET_API __declspec(dllexport)
|
||||
# define TINYNET_GEXTERN __declspec(dllexport)
|
||||
#elif !defined(__GNUC__) /*&& defined(TINYNET_IMPORTS)*/
|
||||
# define TINYNET_API __declspec(dllimport)
|
||||
# define TINYNET_GEXTERN __declspec(dllimport)
|
||||
#else
|
||||
# define TINYNET_API
|
||||
# define TINYNET_GEXTERN extern
|
||||
#endif
|
||||
|
||||
/* Guards against C++ name mangling
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# define TNET_BEGIN_DECLS extern "C" {
|
||||
# define TNET_END_DECLS }
|
||||
#else
|
||||
# define TNET_BEGIN_DECLS
|
||||
# define TNET_END_DECLS
|
||||
#endif
|
||||
|
||||
/* Disable some well-known warnings
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
# pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
#if (_WIN32_WINNT>=0x0600) || (ANDROID) || defined (__APPLE__)
|
||||
# define TNET_HAVE_POLL 1
|
||||
#else
|
||||
# define TNET_HAVE_POLL 0
|
||||
#endif
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
# define TNET_USE_POLL 0 /* Do not use WSAPoll event if under Vista. */
|
||||
#else
|
||||
# define TNET_USE_POLL 1
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) /*|| defined(__SYMBIAN32__)*/
|
||||
# define TNET_HAVE_SS_LEN 1
|
||||
#else
|
||||
# define TNET_HAVE_SS_LEN 0
|
||||
#endif
|
||||
|
||||
#if 0 /* __APPLE__? */
|
||||
# define HAVE_IFADDRS_H 1
|
||||
#else
|
||||
# define HAVE_IFADDRS_H 0
|
||||
#endif
|
||||
|
||||
/* Used in TURN/STUN2 attributes.
|
||||
*/
|
||||
#define TNET_SOFTWARE "IM-client/OMA1.0 doubango/v0.0.0"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#endif /* _TINYNET_H_ */
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tinyNET_config.h
|
||||
* @brief Global configuration file.
|
||||
*
|
||||
* This file incude all your preferences or configuration. All specific configuration
|
||||
* must be defined in this file. You must include this file in all your header files.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#ifndef _TINYNET_H_
|
||||
#define _TINYNET_H_
|
||||
|
||||
#ifdef 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 TNET_UNDER_WINDOWS 1
|
||||
#endif
|
||||
|
||||
/**@def TINYNET_API
|
||||
* Used on Windows and Sysbian systems to export public functions.
|
||||
*/
|
||||
#if !defined(__GNUC__) && defined(TINYNET_EXPORTS)
|
||||
# define TINYNET_API __declspec(dllexport)
|
||||
# define TINYNET_GEXTERN __declspec(dllexport)
|
||||
#elif !defined(__GNUC__) /*&& defined(TINYNET_IMPORTS)*/
|
||||
# define TINYNET_API __declspec(dllimport)
|
||||
# define TINYNET_GEXTERN __declspec(dllimport)
|
||||
#else
|
||||
# define TINYNET_API
|
||||
# define TINYNET_GEXTERN extern
|
||||
#endif
|
||||
|
||||
/* Guards against C++ name mangling
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# define TNET_BEGIN_DECLS extern "C" {
|
||||
# define TNET_END_DECLS }
|
||||
#else
|
||||
# define TNET_BEGIN_DECLS
|
||||
# define TNET_END_DECLS
|
||||
#endif
|
||||
|
||||
/* Disable some well-known warnings
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
# pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
#if (_WIN32_WINNT>=0x0600) || (ANDROID) || defined (__APPLE__)
|
||||
# define TNET_HAVE_POLL 1
|
||||
#else
|
||||
# define TNET_HAVE_POLL 0
|
||||
#endif
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
# define TNET_USE_POLL 0 /* Do not use WSAPoll event if under Vista. */
|
||||
#else
|
||||
# define TNET_USE_POLL 1
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) /*|| defined(__SYMBIAN32__)*/
|
||||
# define TNET_HAVE_SS_LEN 1
|
||||
# define TNET_HAVE_SA_LEN 1
|
||||
#else
|
||||
# define TNET_HAVE_SS_LEN 0
|
||||
# define TNET_HAVE_SA_LEN 0
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# define HAVE_IFADDRS 1
|
||||
#else
|
||||
# define HAVE_IFADDRS 0 /* Windows, ANDROID */
|
||||
#endif
|
||||
|
||||
/* Used in TURN/STUN2 attributes.
|
||||
*/
|
||||
#define TNET_SOFTWARE "IM-client/OMA1.0 doubango/v0.0.0"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#endif /* _TINYNET_H_ */
|
||||
|
||||
|
||||
|
|
|
@ -46,10 +46,9 @@
|
|||
# include <fcntl.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <unistd.h>
|
||||
# if HAVE_IFADDRS_H
|
||||
# include <net/if.h>
|
||||
# if HAVE_IFADDRS
|
||||
# include <ifaddrs.h>
|
||||
# else
|
||||
# include <net/if.h>
|
||||
# endif
|
||||
# if TNET_HAVE_POLL
|
||||
# include <poll.h>
|
||||
|
@ -96,4 +95,4 @@ TNET_END_DECLS
|
|||
|
||||
#endif /* TNET_TYPES_H */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -153,19 +153,60 @@ tnet_interfaces_L_t* tnet_get_interfaces()
|
|||
#undef FREE
|
||||
|
||||
|
||||
#elif HAVE_IFADDRS_H /*=== Using getifaddrs ===*/
|
||||
|
||||
#elif HAVE_IFADDRS /*=== Using getifaddrs ===*/
|
||||
|
||||
// see http://www.kernel.org/doc/man-pages/online/pages/man3/getifaddrs.3.html
|
||||
struct ifaddrs *ifaddr, *ifa;
|
||||
struct ifaddrs *ifaddr = 0, *ifa = 0;
|
||||
|
||||
/* Get interfaces */
|
||||
//if(getifaddrs(&ifaddr) == -1)
|
||||
if(getifaddrs(&ifaddr) == -1)
|
||||
{
|
||||
TSK_DEBUG_ERROR("getifaddrs failed and errno= [%d]", tnet_geterrno());
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
||||
for(ifa = ifaddr; ifa; ifa = ifa->ifa_next)
|
||||
{
|
||||
if(ifa->ifa_addr->sa_family != AF_LINK){
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
{
|
||||
struct ifreq ifr;
|
||||
tnet_fd_t fd = TNET_INVALID_FD;
|
||||
|
||||
if((fd = socket(AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP)) < 0){
|
||||
TSK_DEBUG_ERROR("Failed to create new DGRAM socket and errno= [%d]", tnet_geterrno());
|
||||
goto next;
|
||||
}
|
||||
|
||||
ifr.ifr_addr.sa_family = ifa->ifa_addr->sa_family;
|
||||
strcpy(ifr.ifr_name, ifa.ifa_name);
|
||||
if(tnet_ioctl(fd, SIOCGIFHWADDR, &ifr)<0){
|
||||
TSK_DEBUG_ERROR("tnet_ioctl(SIOCGIFHWADDR)", tnet_geterrno());
|
||||
goto next;
|
||||
}
|
||||
else{
|
||||
//sockaddr_dl* sdl = (struct sockaddr_dl *)ifa->ifa_addr;
|
||||
tnet_interface_t *iface = TNET_INTERFACE_CREATE(ifr->ifr_name, ifr->ifr_hwaddr.sa_data, 6);
|
||||
tsk_list_push_back_data(ifaces, (void**)&(iface));
|
||||
}
|
||||
next:
|
||||
tnet_sockfd_close(&fd);
|
||||
}
|
||||
#else
|
||||
{
|
||||
//struct sockaddr_dl* sdl = (struct sockaddr_dl*)ifa->ifa_addr;
|
||||
tnet_interface_t *iface = TNET_INTERFACE_CREATE(ifa->ifa_name, ifa->ifa_addr, 6);
|
||||
iface->index = if_nametoindex(ifa->ifa_name);
|
||||
tsk_list_push_back_data(ifaces, (void**)&(iface));
|
||||
}
|
||||
#endif
|
||||
|
||||
}/* for */
|
||||
|
||||
freeifaddrs(ifaddr);
|
||||
|
||||
#else /*=== ANDROID,... --> Using SIOCGIFCONF and SIOCGIFHWADDR ===*/
|
||||
|
||||
|
@ -176,7 +217,7 @@ tnet_interfaces_L_t* tnet_get_interfaces()
|
|||
struct sockaddr_in *sin;
|
||||
struct ifreq *ifr;
|
||||
|
||||
if((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
|
||||
if((fd = socket(AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP)) < 0)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new DGRAM socket and errno= [%d]", tnet_geterrno());
|
||||
goto done;
|
||||
|
@ -524,34 +565,34 @@ int tnet_gethostname(tnet_host_t* result)
|
|||
return gethostname(*result, sizeof(*result));
|
||||
}
|
||||
|
||||
int tnet_sockfd_joingroup6(tnet_fd_t fd, const char* multiaddr, unsigned iface_index)
|
||||
{
|
||||
int ret = -1;
|
||||
//struct ipv6_mreq mreq6;
|
||||
//struct sockaddr_storage ss;
|
||||
|
||||
//if((ret = tnet_sockaddr_init(multiaddr, 0, tnet_socket_type_udp_ipv6, &ss)))
|
||||
//{
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
//memcpy(&mreq6.ipv6mr_multiaddr, &((struct sockaddr_in6 *) &ss)->sin6_addr, sizeof(struct in6_addr));
|
||||
//mreq6.ipv6mr_interface = iface_index;
|
||||
|
||||
//if((ret = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char*)&mreq6, sizeof(mreq6))))
|
||||
//{
|
||||
// TNET_PRINT_LAST_ERROR("Failed to join IPv6 multicast group.");
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tnet_sockfd_joingroup6(tnet_fd_t fd, const char* multiaddr, unsigned iface_index)
|
||||
{
|
||||
int ret = -1;
|
||||
//struct ipv6_mreq mreq6;
|
||||
//struct sockaddr_storage ss;
|
||||
|
||||
//if((ret = tnet_sockaddr_init(multiaddr, 0, tnet_socket_type_udp_ipv6, &ss)))
|
||||
//{
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
//memcpy(&mreq6.ipv6mr_multiaddr, &((struct sockaddr_in6 *) &ss)->sin6_addr, sizeof(struct in6_addr));
|
||||
//mreq6.ipv6mr_interface = iface_index;
|
||||
|
||||
//if((ret = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char*)&mreq6, sizeof(mreq6))))
|
||||
//{
|
||||
// TNET_PRINT_LAST_ERROR("Failed to join IPv6 multicast group.");
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tnet_sockfd_leavegroup6(tnet_fd_t fd, const char* multiaddr, unsigned iface_index)
|
||||
{
|
||||
//if(multiaddr)
|
||||
{
|
||||
}
|
||||
//if(multiaddr)
|
||||
{
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -711,8 +752,8 @@ int tnet_sockfd_sendto(tnet_fd_t fd, const struct sockaddr *to, const void* buf,
|
|||
return -2;
|
||||
}
|
||||
|
||||
#if TNET_HAVE_SS_LEN
|
||||
return sendto(fd, buf, size, 0, to, to->ss_len);
|
||||
#if TNET_HAVE_SA_LEN
|
||||
return sendto(fd, buf, size, 0, to, to->sa_len);
|
||||
#else
|
||||
//return sendto(fd, buf, size, 0, to, sizeof(*to));
|
||||
return sendto(fd, buf, size, 0, to,
|
||||
|
@ -730,8 +771,8 @@ int tnet_sockfd_recvfrom(tnet_fd_t fd, void* buf, size_t size, int flags, struct
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if TNET_HAVE_SS_LEN
|
||||
fromlen = from->ss_len;
|
||||
#if TNET_HAVE_SA_LEN
|
||||
fromlen = from->sa_len;
|
||||
#else
|
||||
fromlen = sizeof(*from);
|
||||
#endif
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
#define RUN_TEST_NAT 0
|
||||
#define RUN_TEST_IFACES 0
|
||||
#define RUN_TEST_DNS 0
|
||||
#define RUN_TEST_DHCP 0
|
||||
#define RUN_TEST_DHCP6 1
|
||||
#define RUN_TEST_DHCP 1
|
||||
#define RUN_TEST_DHCP6 0
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
|
|
|
@ -67,7 +67,7 @@ void test_ifaces_dump_addresses()
|
|||
|
||||
void test_ifaces()
|
||||
{
|
||||
test_ifaces_dump_ifaces();
|
||||
test_ifaces_dump_ifaces();
|
||||
test_ifaces_dump_addresses();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "tsk_time.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int tsk_uuidgenerate(tsk_uuidstring_t *result)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,21 +7,95 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
EC9A8D391124B7C90046F5EC /* tsk_ppfcs32.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D351124B7C90046F5EC /* tsk_ppfcs32.c */; };
|
||||
EC9A8D3A1124B7C90046F5EC /* tsk_ppfcs32.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D361124B7C90046F5EC /* tsk_ppfcs32.h */; };
|
||||
EC9A8D3B1124B7C90046F5EC /* tsk_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D371124B7C90046F5EC /* tsk_uuid.c */; };
|
||||
EC9A8D3C1124B7C90046F5EC /* tsk_uuid.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D381124B7C90046F5EC /* tsk_uuid.h */; };
|
||||
EC9A8D991124B8160046F5EC /* tnet_dhcp.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D441124B8160046F5EC /* tnet_dhcp.c */; };
|
||||
EC9A8D9A1124B8160046F5EC /* tnet_dhcp.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D451124B8160046F5EC /* tnet_dhcp.h */; };
|
||||
EC9A8D9B1124B8160046F5EC /* tnet_dhcp_message.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D461124B8160046F5EC /* tnet_dhcp_message.c */; };
|
||||
EC9A8D9C1124B8160046F5EC /* tnet_dhcp_message.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D471124B8160046F5EC /* tnet_dhcp_message.h */; };
|
||||
EC9A8D9D1124B8160046F5EC /* tnet_dhcp_option.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D481124B8160046F5EC /* tnet_dhcp_option.c */; };
|
||||
EC9A8D9E1124B8160046F5EC /* tnet_dhcp_option.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D491124B8160046F5EC /* tnet_dhcp_option.h */; };
|
||||
EC9A8D9F1124B8160046F5EC /* tnet_dhcp_option_sip.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D4A1124B8160046F5EC /* tnet_dhcp_option_sip.c */; };
|
||||
EC9A8DA01124B8160046F5EC /* tnet_dhcp_option_sip.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D4B1124B8160046F5EC /* tnet_dhcp_option_sip.h */; };
|
||||
EC9A8DA11124B8160046F5EC /* tnet_dhcp6.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D4D1124B8160046F5EC /* tnet_dhcp6.c */; };
|
||||
EC9A8DA21124B8160046F5EC /* tnet_dhcp6.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D4E1124B8160046F5EC /* tnet_dhcp6.h */; };
|
||||
EC9A8DA31124B8160046F5EC /* tnet_dhcp6_duid.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D4F1124B8160046F5EC /* tnet_dhcp6_duid.c */; };
|
||||
EC9A8DA41124B8160046F5EC /* tnet_dhcp6_duid.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D501124B8160046F5EC /* tnet_dhcp6_duid.h */; };
|
||||
EC9A8DA51124B8160046F5EC /* tnet_dhcp6_message.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D511124B8160046F5EC /* tnet_dhcp6_message.c */; };
|
||||
EC9A8DA61124B8160046F5EC /* tnet_dhcp6_message.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D521124B8160046F5EC /* tnet_dhcp6_message.h */; };
|
||||
EC9A8DA71124B8160046F5EC /* tnet_dhcp6_option.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D531124B8160046F5EC /* tnet_dhcp6_option.c */; };
|
||||
EC9A8DA81124B8160046F5EC /* tnet_dhcp6_option.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D541124B8160046F5EC /* tnet_dhcp6_option.h */; };
|
||||
EC9A8DA91124B8160046F5EC /* tnet_dns.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D561124B8160046F5EC /* tnet_dns.c */; };
|
||||
EC9A8DAA1124B8160046F5EC /* tnet_dns.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D571124B8160046F5EC /* tnet_dns.h */; };
|
||||
EC9A8DAB1124B8160046F5EC /* tnet_dns_a.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D581124B8160046F5EC /* tnet_dns_a.c */; };
|
||||
EC9A8DAC1124B8160046F5EC /* tnet_dns_a.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D591124B8160046F5EC /* tnet_dns_a.h */; };
|
||||
EC9A8DAD1124B8160046F5EC /* tnet_dns_aaaa.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D5A1124B8160046F5EC /* tnet_dns_aaaa.c */; };
|
||||
EC9A8DAE1124B8160046F5EC /* tnet_dns_aaaa.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D5B1124B8160046F5EC /* tnet_dns_aaaa.h */; };
|
||||
EC9A8DAF1124B8160046F5EC /* tnet_dns_cname.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D5C1124B8160046F5EC /* tnet_dns_cname.c */; };
|
||||
EC9A8DB01124B8160046F5EC /* tnet_dns_cname.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D5D1124B8160046F5EC /* tnet_dns_cname.h */; };
|
||||
EC9A8DB11124B8160046F5EC /* tnet_dns_message.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D5E1124B8160046F5EC /* tnet_dns_message.c */; };
|
||||
EC9A8DB21124B8160046F5EC /* tnet_dns_message.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D5F1124B8160046F5EC /* tnet_dns_message.h */; };
|
||||
EC9A8DB31124B8160046F5EC /* tnet_dns_mx.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D601124B8160046F5EC /* tnet_dns_mx.c */; };
|
||||
EC9A8DB41124B8160046F5EC /* tnet_dns_mx.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D611124B8160046F5EC /* tnet_dns_mx.h */; };
|
||||
EC9A8DB51124B8160046F5EC /* tnet_dns_naptr.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D621124B8160046F5EC /* tnet_dns_naptr.c */; };
|
||||
EC9A8DB61124B8160046F5EC /* tnet_dns_naptr.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D631124B8160046F5EC /* tnet_dns_naptr.h */; };
|
||||
EC9A8DB71124B8160046F5EC /* tnet_dns_ns.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D641124B8160046F5EC /* tnet_dns_ns.c */; };
|
||||
EC9A8DB81124B8160046F5EC /* tnet_dns_ns.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D651124B8160046F5EC /* tnet_dns_ns.h */; };
|
||||
EC9A8DB91124B8160046F5EC /* tnet_dns_opt.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D661124B8160046F5EC /* tnet_dns_opt.c */; };
|
||||
EC9A8DBA1124B8160046F5EC /* tnet_dns_opt.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D671124B8160046F5EC /* tnet_dns_opt.h */; };
|
||||
EC9A8DBB1124B8160046F5EC /* tnet_dns_ptr.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D681124B8160046F5EC /* tnet_dns_ptr.c */; };
|
||||
EC9A8DBC1124B8160046F5EC /* tnet_dns_ptr.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D691124B8160046F5EC /* tnet_dns_ptr.h */; };
|
||||
EC9A8DBD1124B8160046F5EC /* tnet_dns_rr.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D6A1124B8160046F5EC /* tnet_dns_rr.c */; };
|
||||
EC9A8DBE1124B8160046F5EC /* tnet_dns_rr.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D6B1124B8160046F5EC /* tnet_dns_rr.h */; };
|
||||
EC9A8DBF1124B8160046F5EC /* tnet_dns_soa.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D6C1124B8160046F5EC /* tnet_dns_soa.c */; };
|
||||
EC9A8DC01124B8160046F5EC /* tnet_dns_soa.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D6D1124B8160046F5EC /* tnet_dns_soa.h */; };
|
||||
EC9A8DC11124B8160046F5EC /* tnet_dns_srv.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D6E1124B8160046F5EC /* tnet_dns_srv.c */; };
|
||||
EC9A8DC21124B8160046F5EC /* tnet_dns_srv.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D6F1124B8160046F5EC /* tnet_dns_srv.h */; };
|
||||
EC9A8DC31124B8160046F5EC /* tnet_dns_txt.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D701124B8160046F5EC /* tnet_dns_txt.c */; };
|
||||
EC9A8DC41124B8160046F5EC /* tnet_dns_txt.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D711124B8160046F5EC /* tnet_dns_txt.h */; };
|
||||
EC9A8DC51124B8160046F5EC /* tnet_ice.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D731124B8160046F5EC /* tnet_ice.c */; };
|
||||
EC9A8DC61124B8160046F5EC /* tnet_ice.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D741124B8160046F5EC /* tnet_ice.h */; };
|
||||
EC9A8DC81124B8160046F5EC /* tnet_stun.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D781124B8160046F5EC /* tnet_stun.c */; };
|
||||
EC9A8DC91124B8160046F5EC /* tnet_stun.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D791124B8160046F5EC /* tnet_stun.h */; };
|
||||
EC9A8DCA1124B8160046F5EC /* tnet_stun_attribute.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D7A1124B8160046F5EC /* tnet_stun_attribute.c */; };
|
||||
EC9A8DCB1124B8160046F5EC /* tnet_stun_attribute.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D7B1124B8160046F5EC /* tnet_stun_attribute.h */; };
|
||||
EC9A8DCC1124B8160046F5EC /* tnet_stun_message.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D7C1124B8160046F5EC /* tnet_stun_message.c */; };
|
||||
EC9A8DCD1124B8160046F5EC /* tnet_stun_message.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D7D1124B8160046F5EC /* tnet_stun_message.h */; };
|
||||
EC9A8DCE1124B8160046F5EC /* tinyNET_config.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D7E1124B8160046F5EC /* tinyNET_config.h */; };
|
||||
EC9A8DCF1124B8160046F5EC /* tnet.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D7F1124B8160046F5EC /* tnet.c */; };
|
||||
EC9A8DD01124B8160046F5EC /* tnet.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D801124B8160046F5EC /* tnet.h */; };
|
||||
EC9A8DD11124B8160046F5EC /* tnet_auth.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D811124B8160046F5EC /* tnet_auth.c */; };
|
||||
EC9A8DD21124B8160046F5EC /* tnet_auth.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D821124B8160046F5EC /* tnet_auth.h */; };
|
||||
EC9A8DD31124B8160046F5EC /* tnet_hardwares.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D831124B8160046F5EC /* tnet_hardwares.h */; };
|
||||
EC9A8DD41124B8160046F5EC /* tnet_nat.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D841124B8160046F5EC /* tnet_nat.c */; };
|
||||
EC9A8DD51124B8160046F5EC /* tnet_nat.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D851124B8160046F5EC /* tnet_nat.h */; };
|
||||
EC9A8DD61124B8160046F5EC /* tnet_poll.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D861124B8160046F5EC /* tnet_poll.c */; };
|
||||
EC9A8DD71124B8160046F5EC /* tnet_poll.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D871124B8160046F5EC /* tnet_poll.h */; };
|
||||
EC9A8DD81124B8160046F5EC /* tnet_proto.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D881124B8160046F5EC /* tnet_proto.h */; };
|
||||
EC9A8DD91124B8160046F5EC /* tnet_socket.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D891124B8160046F5EC /* tnet_socket.c */; };
|
||||
EC9A8DDA1124B8160046F5EC /* tnet_socket.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D8A1124B8160046F5EC /* tnet_socket.h */; };
|
||||
EC9A8DDB1124B8160046F5EC /* tnet_transport.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D8B1124B8160046F5EC /* tnet_transport.c */; };
|
||||
EC9A8DDC1124B8160046F5EC /* tnet_transport.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D8C1124B8160046F5EC /* tnet_transport.h */; };
|
||||
EC9A8DDD1124B8160046F5EC /* tnet_transport_poll.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D8D1124B8160046F5EC /* tnet_transport_poll.c */; };
|
||||
EC9A8DDE1124B8160046F5EC /* tnet_transport_win32.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D8E1124B8160046F5EC /* tnet_transport_win32.c */; };
|
||||
EC9A8DDF1124B8160046F5EC /* tnet_types.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D8F1124B8160046F5EC /* tnet_types.h */; };
|
||||
EC9A8DE01124B8160046F5EC /* tnet_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D901124B8160046F5EC /* tnet_utils.c */; };
|
||||
EC9A8DE11124B8160046F5EC /* tnet_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D911124B8160046F5EC /* tnet_utils.h */; };
|
||||
EC9A8DE21124B8160046F5EC /* tnet_turn.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D931124B8160046F5EC /* tnet_turn.c */; };
|
||||
EC9A8DE31124B8160046F5EC /* tnet_turn.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D941124B8160046F5EC /* tnet_turn.h */; };
|
||||
EC9A8DE41124B8160046F5EC /* tnet_turn_attribute.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D951124B8160046F5EC /* tnet_turn_attribute.c */; };
|
||||
EC9A8DE51124B8160046F5EC /* tnet_turn_attribute.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D961124B8160046F5EC /* tnet_turn_attribute.h */; };
|
||||
EC9A8DE61124B8160046F5EC /* tnet_turn_message.c in Sources */ = {isa = PBXBuildFile; fileRef = EC9A8D971124B8160046F5EC /* tnet_turn_message.c */; };
|
||||
EC9A8DE71124B8160046F5EC /* tnet_turn_message.h in Headers */ = {isa = PBXBuildFile; fileRef = EC9A8D981124B8160046F5EC /* tnet_turn_message.h */; };
|
||||
ECE5B91610EF65EF00B7EDDD /* tinyNET_config.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B90610EF65EF00B7EDDD /* tinyNET_config.h */; };
|
||||
ECE5B91710EF65EF00B7EDDD /* tnet.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B90710EF65EF00B7EDDD /* tnet.c */; };
|
||||
ECE5B91810EF65EF00B7EDDD /* tnet.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B90810EF65EF00B7EDDD /* tnet.h */; };
|
||||
ECE5B91910EF65EF00B7EDDD /* tnet_auth.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B90910EF65EF00B7EDDD /* tnet_auth.c */; };
|
||||
ECE5B91A10EF65EF00B7EDDD /* tnet_auth.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B90A10EF65EF00B7EDDD /* tnet_auth.h */; };
|
||||
ECE5B91B10EF65EF00B7EDDD /* tnet_poll.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B90B10EF65EF00B7EDDD /* tnet_poll.c */; };
|
||||
ECE5B91C10EF65EF00B7EDDD /* tnet_poll.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B90C10EF65EF00B7EDDD /* tnet_poll.h */; };
|
||||
ECE5B91D10EF65F000B7EDDD /* tnet_socket.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B90D10EF65EF00B7EDDD /* tnet_socket.c */; };
|
||||
ECE5B91E10EF65F000B7EDDD /* tnet_socket.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B90E10EF65EF00B7EDDD /* tnet_socket.h */; };
|
||||
ECE5B91F10EF65F000B7EDDD /* tnet_transport.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B90F10EF65EF00B7EDDD /* tnet_transport.c */; };
|
||||
ECE5B92010EF65F000B7EDDD /* tnet_transport.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B91010EF65EF00B7EDDD /* tnet_transport.h */; };
|
||||
ECE5B92110EF65F000B7EDDD /* tnet_transport_poll.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B91110EF65EF00B7EDDD /* tnet_transport_poll.c */; };
|
||||
ECE5B92210EF65F000B7EDDD /* tnet_transport_win32.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B91210EF65EF00B7EDDD /* tnet_transport_win32.c */; };
|
||||
ECE5B92310EF65F000B7EDDD /* tnet_types.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B91310EF65EF00B7EDDD /* tnet_types.h */; };
|
||||
ECE5B92410EF65F000B7EDDD /* tnet_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5B91410EF65EF00B7EDDD /* tnet_utils.c */; };
|
||||
ECE5B92510EF65F000B7EDDD /* tnet_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5B91510EF65EF00B7EDDD /* tnet_utils.h */; };
|
||||
ECE5BA4A10EF6D8500B7EDDD /* tinySAK_config.h in Headers */ = {isa = PBXBuildFile; fileRef = ECE5BA1510EF6D8500B7EDDD /* tinySAK_config.h */; };
|
||||
ECE5BA4B10EF6D8500B7EDDD /* tsk.c in Sources */ = {isa = PBXBuildFile; fileRef = ECE5BA1610EF6D8500B7EDDD /* tsk.c */; };
|
||||
|
@ -109,21 +183,101 @@
|
|||
|
||||
/* Begin PBXFileReference section */
|
||||
D2AAC0630554660B00DB518D /* libtinyNET.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libtinyNET.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EC9A8CCD1124B74C0046F5EC /* test_dhcp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = test_dhcp.h; path = ../../tinyNET/test/test_dhcp.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8CCE1124B74C0046F5EC /* test_dhcp6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = test_dhcp6.h; path = ../../tinyNET/test/test_dhcp6.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8CCF1124B74C0046F5EC /* test_dns.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = test_dns.h; path = ../../tinyNET/test/test_dns.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8CD01124B74C0046F5EC /* test_ifaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = test_ifaces.h; path = ../../tinyNET/test/test_ifaces.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8CD11124B74C0046F5EC /* test_nat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = test_nat.h; path = ../../tinyNET/test/test_nat.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8CD21124B74C0046F5EC /* test_stun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = test_stun.h; path = ../../tinyNET/test/test_stun.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8D351124B7C90046F5EC /* tsk_ppfcs32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tsk_ppfcs32.c; path = ../../tinySAK/src/tsk_ppfcs32.c; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8D361124B7C90046F5EC /* tsk_ppfcs32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tsk_ppfcs32.h; path = ../../tinySAK/src/tsk_ppfcs32.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8D371124B7C90046F5EC /* tsk_uuid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tsk_uuid.c; path = ../../tinySAK/src/tsk_uuid.c; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8D381124B7C90046F5EC /* tsk_uuid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tsk_uuid.h; path = ../../tinySAK/src/tsk_uuid.h; sourceTree = SOURCE_ROOT; };
|
||||
EC9A8D441124B8160046F5EC /* tnet_dhcp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp.c; sourceTree = "<group>"; };
|
||||
EC9A8D451124B8160046F5EC /* tnet_dhcp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp.h; sourceTree = "<group>"; };
|
||||
EC9A8D461124B8160046F5EC /* tnet_dhcp_message.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp_message.c; sourceTree = "<group>"; };
|
||||
EC9A8D471124B8160046F5EC /* tnet_dhcp_message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp_message.h; sourceTree = "<group>"; };
|
||||
EC9A8D481124B8160046F5EC /* tnet_dhcp_option.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp_option.c; sourceTree = "<group>"; };
|
||||
EC9A8D491124B8160046F5EC /* tnet_dhcp_option.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp_option.h; sourceTree = "<group>"; };
|
||||
EC9A8D4A1124B8160046F5EC /* tnet_dhcp_option_sip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp_option_sip.c; sourceTree = "<group>"; };
|
||||
EC9A8D4B1124B8160046F5EC /* tnet_dhcp_option_sip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp_option_sip.h; sourceTree = "<group>"; };
|
||||
EC9A8D4D1124B8160046F5EC /* tnet_dhcp6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp6.c; sourceTree = "<group>"; };
|
||||
EC9A8D4E1124B8160046F5EC /* tnet_dhcp6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp6.h; sourceTree = "<group>"; };
|
||||
EC9A8D4F1124B8160046F5EC /* tnet_dhcp6_duid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp6_duid.c; sourceTree = "<group>"; };
|
||||
EC9A8D501124B8160046F5EC /* tnet_dhcp6_duid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp6_duid.h; sourceTree = "<group>"; };
|
||||
EC9A8D511124B8160046F5EC /* tnet_dhcp6_message.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp6_message.c; sourceTree = "<group>"; };
|
||||
EC9A8D521124B8160046F5EC /* tnet_dhcp6_message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp6_message.h; sourceTree = "<group>"; };
|
||||
EC9A8D531124B8160046F5EC /* tnet_dhcp6_option.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dhcp6_option.c; sourceTree = "<group>"; };
|
||||
EC9A8D541124B8160046F5EC /* tnet_dhcp6_option.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dhcp6_option.h; sourceTree = "<group>"; };
|
||||
EC9A8D561124B8160046F5EC /* tnet_dns.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns.c; sourceTree = "<group>"; };
|
||||
EC9A8D571124B8160046F5EC /* tnet_dns.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns.h; sourceTree = "<group>"; };
|
||||
EC9A8D581124B8160046F5EC /* tnet_dns_a.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_a.c; sourceTree = "<group>"; };
|
||||
EC9A8D591124B8160046F5EC /* tnet_dns_a.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_a.h; sourceTree = "<group>"; };
|
||||
EC9A8D5A1124B8160046F5EC /* tnet_dns_aaaa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_aaaa.c; sourceTree = "<group>"; };
|
||||
EC9A8D5B1124B8160046F5EC /* tnet_dns_aaaa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_aaaa.h; sourceTree = "<group>"; };
|
||||
EC9A8D5C1124B8160046F5EC /* tnet_dns_cname.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_cname.c; sourceTree = "<group>"; };
|
||||
EC9A8D5D1124B8160046F5EC /* tnet_dns_cname.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_cname.h; sourceTree = "<group>"; };
|
||||
EC9A8D5E1124B8160046F5EC /* tnet_dns_message.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_message.c; sourceTree = "<group>"; };
|
||||
EC9A8D5F1124B8160046F5EC /* tnet_dns_message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_message.h; sourceTree = "<group>"; };
|
||||
EC9A8D601124B8160046F5EC /* tnet_dns_mx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_mx.c; sourceTree = "<group>"; };
|
||||
EC9A8D611124B8160046F5EC /* tnet_dns_mx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_mx.h; sourceTree = "<group>"; };
|
||||
EC9A8D621124B8160046F5EC /* tnet_dns_naptr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_naptr.c; sourceTree = "<group>"; };
|
||||
EC9A8D631124B8160046F5EC /* tnet_dns_naptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_naptr.h; sourceTree = "<group>"; };
|
||||
EC9A8D641124B8160046F5EC /* tnet_dns_ns.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_ns.c; sourceTree = "<group>"; };
|
||||
EC9A8D651124B8160046F5EC /* tnet_dns_ns.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_ns.h; sourceTree = "<group>"; };
|
||||
EC9A8D661124B8160046F5EC /* tnet_dns_opt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_opt.c; sourceTree = "<group>"; };
|
||||
EC9A8D671124B8160046F5EC /* tnet_dns_opt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_opt.h; sourceTree = "<group>"; };
|
||||
EC9A8D681124B8160046F5EC /* tnet_dns_ptr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_ptr.c; sourceTree = "<group>"; };
|
||||
EC9A8D691124B8160046F5EC /* tnet_dns_ptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_ptr.h; sourceTree = "<group>"; };
|
||||
EC9A8D6A1124B8160046F5EC /* tnet_dns_rr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_rr.c; sourceTree = "<group>"; };
|
||||
EC9A8D6B1124B8160046F5EC /* tnet_dns_rr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_rr.h; sourceTree = "<group>"; };
|
||||
EC9A8D6C1124B8160046F5EC /* tnet_dns_soa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_soa.c; sourceTree = "<group>"; };
|
||||
EC9A8D6D1124B8160046F5EC /* tnet_dns_soa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_soa.h; sourceTree = "<group>"; };
|
||||
EC9A8D6E1124B8160046F5EC /* tnet_dns_srv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_srv.c; sourceTree = "<group>"; };
|
||||
EC9A8D6F1124B8160046F5EC /* tnet_dns_srv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_srv.h; sourceTree = "<group>"; };
|
||||
EC9A8D701124B8160046F5EC /* tnet_dns_txt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_dns_txt.c; sourceTree = "<group>"; };
|
||||
EC9A8D711124B8160046F5EC /* tnet_dns_txt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_dns_txt.h; sourceTree = "<group>"; };
|
||||
EC9A8D731124B8160046F5EC /* tnet_ice.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_ice.c; sourceTree = "<group>"; };
|
||||
EC9A8D741124B8160046F5EC /* tnet_ice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_ice.h; sourceTree = "<group>"; };
|
||||
EC9A8D781124B8160046F5EC /* tnet_stun.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_stun.c; sourceTree = "<group>"; };
|
||||
EC9A8D791124B8160046F5EC /* tnet_stun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_stun.h; sourceTree = "<group>"; };
|
||||
EC9A8D7A1124B8160046F5EC /* tnet_stun_attribute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_stun_attribute.c; sourceTree = "<group>"; };
|
||||
EC9A8D7B1124B8160046F5EC /* tnet_stun_attribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_stun_attribute.h; sourceTree = "<group>"; };
|
||||
EC9A8D7C1124B8160046F5EC /* tnet_stun_message.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_stun_message.c; sourceTree = "<group>"; };
|
||||
EC9A8D7D1124B8160046F5EC /* tnet_stun_message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_stun_message.h; sourceTree = "<group>"; };
|
||||
EC9A8D7E1124B8160046F5EC /* tinyNET_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyNET_config.h; sourceTree = "<group>"; };
|
||||
EC9A8D7F1124B8160046F5EC /* tnet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet.c; sourceTree = "<group>"; };
|
||||
EC9A8D801124B8160046F5EC /* tnet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet.h; sourceTree = "<group>"; };
|
||||
EC9A8D811124B8160046F5EC /* tnet_auth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_auth.c; sourceTree = "<group>"; };
|
||||
EC9A8D821124B8160046F5EC /* tnet_auth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_auth.h; sourceTree = "<group>"; };
|
||||
EC9A8D831124B8160046F5EC /* tnet_hardwares.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_hardwares.h; sourceTree = "<group>"; };
|
||||
EC9A8D841124B8160046F5EC /* tnet_nat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_nat.c; sourceTree = "<group>"; };
|
||||
EC9A8D851124B8160046F5EC /* tnet_nat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_nat.h; sourceTree = "<group>"; };
|
||||
EC9A8D861124B8160046F5EC /* tnet_poll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_poll.c; sourceTree = "<group>"; };
|
||||
EC9A8D871124B8160046F5EC /* tnet_poll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_poll.h; sourceTree = "<group>"; };
|
||||
EC9A8D881124B8160046F5EC /* tnet_proto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_proto.h; sourceTree = "<group>"; };
|
||||
EC9A8D891124B8160046F5EC /* tnet_socket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_socket.c; sourceTree = "<group>"; };
|
||||
EC9A8D8A1124B8160046F5EC /* tnet_socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_socket.h; sourceTree = "<group>"; };
|
||||
EC9A8D8B1124B8160046F5EC /* tnet_transport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_transport.c; sourceTree = "<group>"; };
|
||||
EC9A8D8C1124B8160046F5EC /* tnet_transport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_transport.h; sourceTree = "<group>"; };
|
||||
EC9A8D8D1124B8160046F5EC /* tnet_transport_poll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_transport_poll.c; sourceTree = "<group>"; };
|
||||
EC9A8D8E1124B8160046F5EC /* tnet_transport_win32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_transport_win32.c; sourceTree = "<group>"; };
|
||||
EC9A8D8F1124B8160046F5EC /* tnet_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_types.h; sourceTree = "<group>"; };
|
||||
EC9A8D901124B8160046F5EC /* tnet_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_utils.c; sourceTree = "<group>"; };
|
||||
EC9A8D911124B8160046F5EC /* tnet_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_utils.h; sourceTree = "<group>"; };
|
||||
EC9A8D931124B8160046F5EC /* tnet_turn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_turn.c; sourceTree = "<group>"; };
|
||||
EC9A8D941124B8160046F5EC /* tnet_turn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_turn.h; sourceTree = "<group>"; };
|
||||
EC9A8D951124B8160046F5EC /* tnet_turn_attribute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_turn_attribute.c; sourceTree = "<group>"; };
|
||||
EC9A8D961124B8160046F5EC /* tnet_turn_attribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_turn_attribute.h; sourceTree = "<group>"; };
|
||||
EC9A8D971124B8160046F5EC /* tnet_turn_message.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tnet_turn_message.c; sourceTree = "<group>"; };
|
||||
EC9A8D981124B8160046F5EC /* tnet_turn_message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tnet_turn_message.h; sourceTree = "<group>"; };
|
||||
ECE5B90610EF65EF00B7EDDD /* tinyNET_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tinyNET_config.h; path = ../../tinyNET/src/tinyNET_config.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90710EF65EF00B7EDDD /* tnet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet.c; path = ../../tinyNET/src/tnet.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90810EF65EF00B7EDDD /* tnet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tnet.h; path = ../../tinyNET/src/tnet.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90910EF65EF00B7EDDD /* tnet_auth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet_auth.c; path = ../../tinyNET/src/tnet_auth.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90A10EF65EF00B7EDDD /* tnet_auth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tnet_auth.h; path = ../../tinyNET/src/tnet_auth.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90B10EF65EF00B7EDDD /* tnet_poll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet_poll.c; path = ../../tinyNET/src/tnet_poll.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90C10EF65EF00B7EDDD /* tnet_poll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tnet_poll.h; path = ../../tinyNET/src/tnet_poll.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90D10EF65EF00B7EDDD /* tnet_socket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet_socket.c; path = ../../tinyNET/src/tnet_socket.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90E10EF65EF00B7EDDD /* tnet_socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tnet_socket.h; path = ../../tinyNET/src/tnet_socket.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B90F10EF65EF00B7EDDD /* tnet_transport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet_transport.c; path = ../../tinyNET/src/tnet_transport.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B91010EF65EF00B7EDDD /* tnet_transport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tnet_transport.h; path = ../../tinyNET/src/tnet_transport.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B91110EF65EF00B7EDDD /* tnet_transport_poll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet_transport_poll.c; path = ../../tinyNET/src/tnet_transport_poll.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B91210EF65EF00B7EDDD /* tnet_transport_win32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet_transport_win32.c; path = ../../tinyNET/src/tnet_transport_win32.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B91310EF65EF00B7EDDD /* tnet_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tnet_types.h; path = ../../tinyNET/src/tnet_types.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B91410EF65EF00B7EDDD /* tnet_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tnet_utils.c; path = ../../tinyNET/src/tnet_utils.c; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B91510EF65EF00B7EDDD /* tnet_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tnet_utils.h; path = ../../tinyNET/src/tnet_utils.h; sourceTree = SOURCE_ROOT; };
|
||||
ECE5B98410EF6B6F00B7EDDD /* libtinySAK.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libtinySAK.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
ECE5BA1510EF6D8500B7EDDD /* tinySAK_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tinySAK_config.h; path = ../../tinySAK/src/tinySAK_config.h; sourceTree = SOURCE_ROOT; };
|
||||
|
@ -221,30 +375,15 @@
|
|||
08FB7794FE84155DC02AAC07 /* tinyNET */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D421124B8160046F5EC /* src */,
|
||||
ECE5BA9810EF6E0600B7EDDD /* test */,
|
||||
ECE5BA1410EF6D5500B7EDDD /* tinySAK */,
|
||||
ECE5B90310EF65C200B7EDDD /* include */,
|
||||
08FB7795FE84155DC02AAC07 /* Source */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
);
|
||||
name = tinyNET;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB7795FE84155DC02AAC07 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ECE5B90710EF65EF00B7EDDD /* tnet.c */,
|
||||
ECE5B90910EF65EF00B7EDDD /* tnet_auth.c */,
|
||||
ECE5B90B10EF65EF00B7EDDD /* tnet_poll.c */,
|
||||
ECE5B90D10EF65EF00B7EDDD /* tnet_socket.c */,
|
||||
ECE5B90F10EF65EF00B7EDDD /* tnet_transport.c */,
|
||||
ECE5B91110EF65EF00B7EDDD /* tnet_transport_poll.c */,
|
||||
ECE5B91210EF65EF00B7EDDD /* tnet_transport_win32.c */,
|
||||
ECE5B91410EF65EF00B7EDDD /* tnet_utils.c */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -255,6 +394,148 @@
|
|||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EC9A8D421124B8160046F5EC /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D431124B8160046F5EC /* dhcp */,
|
||||
EC9A8D4C1124B8160046F5EC /* dhcp6 */,
|
||||
EC9A8D551124B8160046F5EC /* dns */,
|
||||
EC9A8D721124B8160046F5EC /* ice */,
|
||||
EC9A8D761124B8160046F5EC /* parsers */,
|
||||
EC9A8D771124B8160046F5EC /* stun */,
|
||||
EC9A8D7E1124B8160046F5EC /* tinyNET_config.h */,
|
||||
EC9A8D7F1124B8160046F5EC /* tnet.c */,
|
||||
EC9A8D801124B8160046F5EC /* tnet.h */,
|
||||
EC9A8D811124B8160046F5EC /* tnet_auth.c */,
|
||||
EC9A8D821124B8160046F5EC /* tnet_auth.h */,
|
||||
EC9A8D831124B8160046F5EC /* tnet_hardwares.h */,
|
||||
EC9A8D841124B8160046F5EC /* tnet_nat.c */,
|
||||
EC9A8D851124B8160046F5EC /* tnet_nat.h */,
|
||||
EC9A8D861124B8160046F5EC /* tnet_poll.c */,
|
||||
EC9A8D871124B8160046F5EC /* tnet_poll.h */,
|
||||
EC9A8D881124B8160046F5EC /* tnet_proto.h */,
|
||||
EC9A8D891124B8160046F5EC /* tnet_socket.c */,
|
||||
EC9A8D8A1124B8160046F5EC /* tnet_socket.h */,
|
||||
EC9A8D8B1124B8160046F5EC /* tnet_transport.c */,
|
||||
EC9A8D8C1124B8160046F5EC /* tnet_transport.h */,
|
||||
EC9A8D8D1124B8160046F5EC /* tnet_transport_poll.c */,
|
||||
EC9A8D8E1124B8160046F5EC /* tnet_transport_win32.c */,
|
||||
EC9A8D8F1124B8160046F5EC /* tnet_types.h */,
|
||||
EC9A8D901124B8160046F5EC /* tnet_utils.c */,
|
||||
EC9A8D911124B8160046F5EC /* tnet_utils.h */,
|
||||
EC9A8D921124B8160046F5EC /* turn */,
|
||||
);
|
||||
name = src;
|
||||
path = ../../tinyNET/src;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
EC9A8D431124B8160046F5EC /* dhcp */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D441124B8160046F5EC /* tnet_dhcp.c */,
|
||||
EC9A8D451124B8160046F5EC /* tnet_dhcp.h */,
|
||||
EC9A8D461124B8160046F5EC /* tnet_dhcp_message.c */,
|
||||
EC9A8D471124B8160046F5EC /* tnet_dhcp_message.h */,
|
||||
EC9A8D481124B8160046F5EC /* tnet_dhcp_option.c */,
|
||||
EC9A8D491124B8160046F5EC /* tnet_dhcp_option.h */,
|
||||
EC9A8D4A1124B8160046F5EC /* tnet_dhcp_option_sip.c */,
|
||||
EC9A8D4B1124B8160046F5EC /* tnet_dhcp_option_sip.h */,
|
||||
);
|
||||
path = dhcp;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EC9A8D4C1124B8160046F5EC /* dhcp6 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D4D1124B8160046F5EC /* tnet_dhcp6.c */,
|
||||
EC9A8D4E1124B8160046F5EC /* tnet_dhcp6.h */,
|
||||
EC9A8D4F1124B8160046F5EC /* tnet_dhcp6_duid.c */,
|
||||
EC9A8D501124B8160046F5EC /* tnet_dhcp6_duid.h */,
|
||||
EC9A8D511124B8160046F5EC /* tnet_dhcp6_message.c */,
|
||||
EC9A8D521124B8160046F5EC /* tnet_dhcp6_message.h */,
|
||||
EC9A8D531124B8160046F5EC /* tnet_dhcp6_option.c */,
|
||||
EC9A8D541124B8160046F5EC /* tnet_dhcp6_option.h */,
|
||||
);
|
||||
path = dhcp6;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EC9A8D551124B8160046F5EC /* dns */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D561124B8160046F5EC /* tnet_dns.c */,
|
||||
EC9A8D571124B8160046F5EC /* tnet_dns.h */,
|
||||
EC9A8D581124B8160046F5EC /* tnet_dns_a.c */,
|
||||
EC9A8D591124B8160046F5EC /* tnet_dns_a.h */,
|
||||
EC9A8D5A1124B8160046F5EC /* tnet_dns_aaaa.c */,
|
||||
EC9A8D5B1124B8160046F5EC /* tnet_dns_aaaa.h */,
|
||||
EC9A8D5C1124B8160046F5EC /* tnet_dns_cname.c */,
|
||||
EC9A8D5D1124B8160046F5EC /* tnet_dns_cname.h */,
|
||||
EC9A8D5E1124B8160046F5EC /* tnet_dns_message.c */,
|
||||
EC9A8D5F1124B8160046F5EC /* tnet_dns_message.h */,
|
||||
EC9A8D601124B8160046F5EC /* tnet_dns_mx.c */,
|
||||
EC9A8D611124B8160046F5EC /* tnet_dns_mx.h */,
|
||||
EC9A8D621124B8160046F5EC /* tnet_dns_naptr.c */,
|
||||
EC9A8D631124B8160046F5EC /* tnet_dns_naptr.h */,
|
||||
EC9A8D641124B8160046F5EC /* tnet_dns_ns.c */,
|
||||
EC9A8D651124B8160046F5EC /* tnet_dns_ns.h */,
|
||||
EC9A8D661124B8160046F5EC /* tnet_dns_opt.c */,
|
||||
EC9A8D671124B8160046F5EC /* tnet_dns_opt.h */,
|
||||
EC9A8D681124B8160046F5EC /* tnet_dns_ptr.c */,
|
||||
EC9A8D691124B8160046F5EC /* tnet_dns_ptr.h */,
|
||||
EC9A8D6A1124B8160046F5EC /* tnet_dns_rr.c */,
|
||||
EC9A8D6B1124B8160046F5EC /* tnet_dns_rr.h */,
|
||||
EC9A8D6C1124B8160046F5EC /* tnet_dns_soa.c */,
|
||||
EC9A8D6D1124B8160046F5EC /* tnet_dns_soa.h */,
|
||||
EC9A8D6E1124B8160046F5EC /* tnet_dns_srv.c */,
|
||||
EC9A8D6F1124B8160046F5EC /* tnet_dns_srv.h */,
|
||||
EC9A8D701124B8160046F5EC /* tnet_dns_txt.c */,
|
||||
EC9A8D711124B8160046F5EC /* tnet_dns_txt.h */,
|
||||
);
|
||||
path = dns;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EC9A8D721124B8160046F5EC /* ice */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D731124B8160046F5EC /* tnet_ice.c */,
|
||||
EC9A8D741124B8160046F5EC /* tnet_ice.h */,
|
||||
);
|
||||
path = ice;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EC9A8D761124B8160046F5EC /* parsers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = parsers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EC9A8D771124B8160046F5EC /* stun */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D781124B8160046F5EC /* tnet_stun.c */,
|
||||
EC9A8D791124B8160046F5EC /* tnet_stun.h */,
|
||||
EC9A8D7A1124B8160046F5EC /* tnet_stun_attribute.c */,
|
||||
EC9A8D7B1124B8160046F5EC /* tnet_stun_attribute.h */,
|
||||
EC9A8D7C1124B8160046F5EC /* tnet_stun_message.c */,
|
||||
EC9A8D7D1124B8160046F5EC /* tnet_stun_message.h */,
|
||||
);
|
||||
path = stun;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EC9A8D921124B8160046F5EC /* turn */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D931124B8160046F5EC /* tnet_turn.c */,
|
||||
EC9A8D941124B8160046F5EC /* tnet_turn.h */,
|
||||
EC9A8D951124B8160046F5EC /* tnet_turn_attribute.c */,
|
||||
EC9A8D961124B8160046F5EC /* tnet_turn_attribute.h */,
|
||||
EC9A8D971124B8160046F5EC /* tnet_turn_message.c */,
|
||||
EC9A8D981124B8160046F5EC /* tnet_turn_message.h */,
|
||||
);
|
||||
path = turn;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
ECE5B90310EF65C200B7EDDD /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -273,6 +554,10 @@
|
|||
ECE5BA1410EF6D5500B7EDDD /* tinySAK */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8D351124B7C90046F5EC /* tsk_ppfcs32.c */,
|
||||
EC9A8D361124B7C90046F5EC /* tsk_ppfcs32.h */,
|
||||
EC9A8D371124B7C90046F5EC /* tsk_uuid.c */,
|
||||
EC9A8D381124B7C90046F5EC /* tsk_uuid.h */,
|
||||
ECE5BA1510EF6D8500B7EDDD /* tinySAK_config.h */,
|
||||
ECE5BA1610EF6D8500B7EDDD /* tsk.c */,
|
||||
ECE5BA1710EF6D8500B7EDDD /* tsk.h */,
|
||||
|
@ -333,6 +618,12 @@
|
|||
ECE5BA9810EF6E0600B7EDDD /* test */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC9A8CCD1124B74C0046F5EC /* test_dhcp.h */,
|
||||
EC9A8CCE1124B74C0046F5EC /* test_dhcp6.h */,
|
||||
EC9A8CCF1124B74C0046F5EC /* test_dns.h */,
|
||||
EC9A8CD01124B74C0046F5EC /* test_ifaces.h */,
|
||||
EC9A8CD11124B74C0046F5EC /* test_nat.h */,
|
||||
EC9A8CD21124B74C0046F5EC /* test_stun.h */,
|
||||
ECE5BAA710EF6E4800B7EDDD /* stdafx.c */,
|
||||
ECE5BAA810EF6E4800B7EDDD /* stdafx.h */,
|
||||
ECE5BAA910EF6E4800B7EDDD /* targetver.h */,
|
||||
|
@ -360,6 +651,46 @@
|
|||
ECE5B92010EF65F000B7EDDD /* tnet_transport.h in Headers */,
|
||||
ECE5B92310EF65F000B7EDDD /* tnet_types.h in Headers */,
|
||||
ECE5B92510EF65F000B7EDDD /* tnet_utils.h in Headers */,
|
||||
EC9A8D9A1124B8160046F5EC /* tnet_dhcp.h in Headers */,
|
||||
EC9A8D9C1124B8160046F5EC /* tnet_dhcp_message.h in Headers */,
|
||||
EC9A8D9E1124B8160046F5EC /* tnet_dhcp_option.h in Headers */,
|
||||
EC9A8DA01124B8160046F5EC /* tnet_dhcp_option_sip.h in Headers */,
|
||||
EC9A8DA21124B8160046F5EC /* tnet_dhcp6.h in Headers */,
|
||||
EC9A8DA41124B8160046F5EC /* tnet_dhcp6_duid.h in Headers */,
|
||||
EC9A8DA61124B8160046F5EC /* tnet_dhcp6_message.h in Headers */,
|
||||
EC9A8DA81124B8160046F5EC /* tnet_dhcp6_option.h in Headers */,
|
||||
EC9A8DAA1124B8160046F5EC /* tnet_dns.h in Headers */,
|
||||
EC9A8DAC1124B8160046F5EC /* tnet_dns_a.h in Headers */,
|
||||
EC9A8DAE1124B8160046F5EC /* tnet_dns_aaaa.h in Headers */,
|
||||
EC9A8DB01124B8160046F5EC /* tnet_dns_cname.h in Headers */,
|
||||
EC9A8DB21124B8160046F5EC /* tnet_dns_message.h in Headers */,
|
||||
EC9A8DB41124B8160046F5EC /* tnet_dns_mx.h in Headers */,
|
||||
EC9A8DB61124B8160046F5EC /* tnet_dns_naptr.h in Headers */,
|
||||
EC9A8DB81124B8160046F5EC /* tnet_dns_ns.h in Headers */,
|
||||
EC9A8DBA1124B8160046F5EC /* tnet_dns_opt.h in Headers */,
|
||||
EC9A8DBC1124B8160046F5EC /* tnet_dns_ptr.h in Headers */,
|
||||
EC9A8DBE1124B8160046F5EC /* tnet_dns_rr.h in Headers */,
|
||||
EC9A8DC01124B8160046F5EC /* tnet_dns_soa.h in Headers */,
|
||||
EC9A8DC21124B8160046F5EC /* tnet_dns_srv.h in Headers */,
|
||||
EC9A8DC41124B8160046F5EC /* tnet_dns_txt.h in Headers */,
|
||||
EC9A8DC61124B8160046F5EC /* tnet_ice.h in Headers */,
|
||||
EC9A8DC91124B8160046F5EC /* tnet_stun.h in Headers */,
|
||||
EC9A8DCB1124B8160046F5EC /* tnet_stun_attribute.h in Headers */,
|
||||
EC9A8DCD1124B8160046F5EC /* tnet_stun_message.h in Headers */,
|
||||
EC9A8DCE1124B8160046F5EC /* tinyNET_config.h in Headers */,
|
||||
EC9A8DD01124B8160046F5EC /* tnet.h in Headers */,
|
||||
EC9A8DD21124B8160046F5EC /* tnet_auth.h in Headers */,
|
||||
EC9A8DD31124B8160046F5EC /* tnet_hardwares.h in Headers */,
|
||||
EC9A8DD51124B8160046F5EC /* tnet_nat.h in Headers */,
|
||||
EC9A8DD71124B8160046F5EC /* tnet_poll.h in Headers */,
|
||||
EC9A8DD81124B8160046F5EC /* tnet_proto.h in Headers */,
|
||||
EC9A8DDA1124B8160046F5EC /* tnet_socket.h in Headers */,
|
||||
EC9A8DDC1124B8160046F5EC /* tnet_transport.h in Headers */,
|
||||
EC9A8DDF1124B8160046F5EC /* tnet_types.h in Headers */,
|
||||
EC9A8DE11124B8160046F5EC /* tnet_utils.h in Headers */,
|
||||
EC9A8DE31124B8160046F5EC /* tnet_turn.h in Headers */,
|
||||
EC9A8DE51124B8160046F5EC /* tnet_turn_attribute.h in Headers */,
|
||||
EC9A8DE71124B8160046F5EC /* tnet_turn_message.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -395,6 +726,8 @@
|
|||
ECE5BA7A10EF6D8500B7EDDD /* tsk_timer.h in Headers */,
|
||||
ECE5BA7C10EF6D8500B7EDDD /* tsk_url.h in Headers */,
|
||||
ECE5BA7E10EF6D8500B7EDDD /* tsk_xml.h in Headers */,
|
||||
EC9A8D3A1124B7C90046F5EC /* tsk_ppfcs32.h in Headers */,
|
||||
EC9A8D3C1124B7C90046F5EC /* tsk_uuid.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -478,14 +811,44 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
ECE5B91710EF65EF00B7EDDD /* tnet.c in Sources */,
|
||||
ECE5B91910EF65EF00B7EDDD /* tnet_auth.c in Sources */,
|
||||
ECE5B91B10EF65EF00B7EDDD /* tnet_poll.c in Sources */,
|
||||
ECE5B91D10EF65F000B7EDDD /* tnet_socket.c in Sources */,
|
||||
ECE5B91F10EF65F000B7EDDD /* tnet_transport.c in Sources */,
|
||||
ECE5B92110EF65F000B7EDDD /* tnet_transport_poll.c in Sources */,
|
||||
ECE5B92210EF65F000B7EDDD /* tnet_transport_win32.c in Sources */,
|
||||
ECE5B92410EF65F000B7EDDD /* tnet_utils.c in Sources */,
|
||||
EC9A8D991124B8160046F5EC /* tnet_dhcp.c in Sources */,
|
||||
EC9A8D9B1124B8160046F5EC /* tnet_dhcp_message.c in Sources */,
|
||||
EC9A8D9D1124B8160046F5EC /* tnet_dhcp_option.c in Sources */,
|
||||
EC9A8D9F1124B8160046F5EC /* tnet_dhcp_option_sip.c in Sources */,
|
||||
EC9A8DA11124B8160046F5EC /* tnet_dhcp6.c in Sources */,
|
||||
EC9A8DA31124B8160046F5EC /* tnet_dhcp6_duid.c in Sources */,
|
||||
EC9A8DA51124B8160046F5EC /* tnet_dhcp6_message.c in Sources */,
|
||||
EC9A8DA71124B8160046F5EC /* tnet_dhcp6_option.c in Sources */,
|
||||
EC9A8DA91124B8160046F5EC /* tnet_dns.c in Sources */,
|
||||
EC9A8DAB1124B8160046F5EC /* tnet_dns_a.c in Sources */,
|
||||
EC9A8DAD1124B8160046F5EC /* tnet_dns_aaaa.c in Sources */,
|
||||
EC9A8DAF1124B8160046F5EC /* tnet_dns_cname.c in Sources */,
|
||||
EC9A8DB11124B8160046F5EC /* tnet_dns_message.c in Sources */,
|
||||
EC9A8DB31124B8160046F5EC /* tnet_dns_mx.c in Sources */,
|
||||
EC9A8DB51124B8160046F5EC /* tnet_dns_naptr.c in Sources */,
|
||||
EC9A8DB71124B8160046F5EC /* tnet_dns_ns.c in Sources */,
|
||||
EC9A8DB91124B8160046F5EC /* tnet_dns_opt.c in Sources */,
|
||||
EC9A8DBB1124B8160046F5EC /* tnet_dns_ptr.c in Sources */,
|
||||
EC9A8DBD1124B8160046F5EC /* tnet_dns_rr.c in Sources */,
|
||||
EC9A8DBF1124B8160046F5EC /* tnet_dns_soa.c in Sources */,
|
||||
EC9A8DC11124B8160046F5EC /* tnet_dns_srv.c in Sources */,
|
||||
EC9A8DC31124B8160046F5EC /* tnet_dns_txt.c in Sources */,
|
||||
EC9A8DC51124B8160046F5EC /* tnet_ice.c in Sources */,
|
||||
EC9A8DC81124B8160046F5EC /* tnet_stun.c in Sources */,
|
||||
EC9A8DCA1124B8160046F5EC /* tnet_stun_attribute.c in Sources */,
|
||||
EC9A8DCC1124B8160046F5EC /* tnet_stun_message.c in Sources */,
|
||||
EC9A8DCF1124B8160046F5EC /* tnet.c in Sources */,
|
||||
EC9A8DD11124B8160046F5EC /* tnet_auth.c in Sources */,
|
||||
EC9A8DD41124B8160046F5EC /* tnet_nat.c in Sources */,
|
||||
EC9A8DD61124B8160046F5EC /* tnet_poll.c in Sources */,
|
||||
EC9A8DD91124B8160046F5EC /* tnet_socket.c in Sources */,
|
||||
EC9A8DDB1124B8160046F5EC /* tnet_transport.c in Sources */,
|
||||
EC9A8DDD1124B8160046F5EC /* tnet_transport_poll.c in Sources */,
|
||||
EC9A8DDE1124B8160046F5EC /* tnet_transport_win32.c in Sources */,
|
||||
EC9A8DE01124B8160046F5EC /* tnet_utils.c in Sources */,
|
||||
EC9A8DE21124B8160046F5EC /* tnet_turn.c in Sources */,
|
||||
EC9A8DE41124B8160046F5EC /* tnet_turn_attribute.c in Sources */,
|
||||
EC9A8DE61124B8160046F5EC /* tnet_turn_message.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -518,6 +881,8 @@
|
|||
ECE5BA7910EF6D8500B7EDDD /* tsk_timer.c in Sources */,
|
||||
ECE5BA7B10EF6D8500B7EDDD /* tsk_url.c in Sources */,
|
||||
ECE5BA7D10EF6D8500B7EDDD /* tsk_xml.c in Sources */,
|
||||
EC9A8D391124B7C90046F5EC /* tsk_ppfcs32.c in Sources */,
|
||||
EC9A8D3B1124B7C90046F5EC /* tsk_uuid.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -561,6 +926,7 @@
|
|||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
HEADER_SEARCH_PATHS = ../../tinyNET/src;
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
PRODUCT_NAME = tinyNET;
|
||||
};
|
||||
|
@ -649,6 +1015,7 @@
|
|||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
HEADER_SEARCH_PATHS = ../../tinyNET/src;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = test;
|
||||
|
|
Loading…
Reference in New Issue