Commit d461e65b authored by Simon Morlat's avatar Simon Morlat

belle-sip builds with visual studio express 2012, without CUnit for the

moment.
parent b3818f30
......@@ -2,6 +2,7 @@ Dependencies:
libantlr3c-3.2
antlr3-3.2
CUinit-2.x
Newer versions won't compile.
......@@ -11,5 +12,38 @@ replace:
by:
#include <winsock2.h>
Or get the source code from linphone's git (linphone branch):
git clone -b linphone git://git.linphone.org/libantlr3c.git
Prequisites
***********
You must jave 'java' in your PATH.
Build with mingw
****************
* Compile and install libantlr3c, CUnit with ./configure && make && make install
* Compile belle-sip.
Build with Visual Studio
************************
The procedure is tested for Visual Studio Express 2012.
* get libantlr3c from linphone's git server (see above). This version contains up to date visual studio project and solution files.
* put belle-sip next to libantlr3c (in the same directory).
* open belle-sip/build/windows/belle-sip/belle-sip.sln
* cp antlr.jar into belle-sip/build/windows/belle-sip
* Build the solution (antlr3c is built automatically)

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "belle-sip", "belle-sip.vcxproj", "{300E2173-D3DA-48BB-9410-7F4E953CE5D1}"
ProjectSection(ProjectDependencies) = postProject
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40} = {0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libantlr3c", "..\..\..\..\libantlr3c\build\vsx\libantlr3c.vcxproj", "{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugDLL|Win32 = DebugDLL|Win32
DebugDLL|x64 = DebugDLL|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseDLL|Win32 = ReleaseDLL|Win32
ReleaseDLL|x64 = ReleaseDLL|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.Debug|Win32.ActiveCfg = DebugDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.Debug|Win32.Build.0 = DebugDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.Debug|x64.ActiveCfg = DebugDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.DebugDLL|x64.ActiveCfg = DebugDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.Release|Win32.ActiveCfg = ReleaseDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.Release|Win32.Build.0 = ReleaseDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.Release|x64.ActiveCfg = ReleaseDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
{300E2173-D3DA-48BB-9410-7F4E953CE5D1}.ReleaseDLL|x64.ActiveCfg = ReleaseDLL|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Debug|Win32.ActiveCfg = Debug|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Debug|Win32.Build.0 = Debug|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Debug|x64.ActiveCfg = Debug|x64
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Debug|x64.Build.0 = Debug|x64
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.DebugDLL|x64.ActiveCfg = DebugDLL|x64
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.DebugDLL|x64.Build.0 = DebugDLL|x64
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Release|Win32.ActiveCfg = Release|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Release|Win32.Build.0 = Release|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Release|x64.ActiveCfg = Release|x64
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.Release|x64.Build.0 = Release|x64
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.ReleaseDLL|x64.ActiveCfg = ReleaseDLL|x64
{0F0FE03A-78F3-4B34-9DCE-0CDFF1FB5C40}.ReleaseDLL|x64.Build.0 = ReleaseDLL|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
This diff is collapsed.
......@@ -28,6 +28,10 @@
#define BELLE_SIP_END_DECLS
#endif
#ifdef _MSC_VER
#define inline __inline
#endif
#include "belle-sip/object.h"
/**
......
......@@ -22,11 +22,6 @@
#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#ifdef WIN32
#include <windows.h>
#endif
/***************/
/* logging api */
......
......@@ -28,7 +28,7 @@ GET_SET_STRING(belle_sip_auth_event,realm)
GET_SET_STRING(belle_sip_auth_event,passwd)
GET_SET_STRING(belle_sip_auth_event,ha1)
belle_sip_auth_event_t* belle_sip_auth_event_create(const char* realm,const char* username) {
belle_sip_auth_event_t* result = belle_sip_malloc(sizeof(belle_sip_auth_event_t));
belle_sip_auth_event_t* result = belle_sip_new(belle_sip_auth_event_t);
memset(result,0,sizeof(belle_sip_auth_event_t));
belle_sip_auth_event_set_realm(result,realm);
belle_sip_auth_event_set_username(result,username);
......
......@@ -120,9 +120,11 @@ int belle_sip_auth_helper_compute_response_qop_auth(const char* ha1
, const char* ha2, char response[33]) {
md5_byte_t out[16];
md5_state_t state;
response[32]='\0';
char nounce_count_as_string[9];
int di;
response[32]='\0';
snprintf(nounce_count_as_string,sizeof(nounce_count_as_string),"%08x",nonce_count);
/*response=MD5(HA1:nonce:nonce_count:cnonce:qop:HA2)*/
......@@ -162,9 +164,10 @@ int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* a
char* uri;
char ha2[16*2 + 1];
char response[16*2 + 1];
response[32]=ha2[32]='\0';
char cnonce[9];
response[32]=ha2[32]='\0';
if (belle_sip_header_authorization_get_scheme(authorization) != NULL &&
strcmp("Digest",belle_sip_header_authorization_get_scheme(authorization))!=0) {
belle_sip_error("belle_sip_fill_authorization_header, unsupported schema [%s]"
......
......@@ -123,10 +123,11 @@ time_field: {IS_TOKEN(t)}?alpha_num EQUAL
SPACE
stop_time {belle_sdp_time_description_t* time_description =belle_sdp_time_description_new();
belle_sdp_time_t* time_value =belle_sdp_time_new();
belle_sip_list_t* time_description_list;
belle_sdp_time_set_start(time_value,atoi((const char*)$start_time.text->chars));
belle_sdp_time_set_stop(time_value,atoi((const char*)$stop_time.text->chars));
belle_sdp_time_description_set_time(time_description,time_value);
belle_sip_list_t* time_description_list = belle_sip_list_append(NULL,time_description);
time_description_list = belle_sip_list_append(NULL,time_description);
belle_sdp_session_description_set_time_descriptions($session_description::current,time_description_list);};
repeat_time: {IS_TOKEN(r)}?alpha_num EQUAL repeat_interval (SPACE typed_time)+;
......
......@@ -801,6 +801,7 @@ belle_sip_header_extension_t* belle_sip_header_extension_parse (const char* valu
pbelle_sip_messageLexer lex;
pANTLR3_COMMON_TOKEN_STREAM tokens;
pbelle_sip_messageParser parser;
belle_sip_messageParser_header_extension_return l_parsed_object;
input = antlr3NewAsciiStringCopyStream (
(pANTLR3_UINT8)value,
(ANTLR3_UINT32)strlen(value),
......@@ -808,7 +809,7 @@ belle_sip_header_extension_t* belle_sip_header_extension_parse (const char* valu
lex = belle_sip_messageLexerNew (input);
tokens = antlr3CommonTokenStreamSourceNew (1025, lex->pLexer->rec->state->tokSource);
parser = belle_sip_messageParserNew (tokens);
belle_sip_messageParser_header_extension_return l_parsed_object = parser->header_extension(parser,FALSE);
l_parsed_object = parser->header_extension(parser,FALSE);
parser ->free(parser);
tokens ->free(tokens);
lex ->free(lex);
......@@ -852,8 +853,9 @@ GET_SET_STRING(belle_sip_header_extension,value);
#define AUTH_BASE_MARSHAL(header) \
unsigned int current_offset=offset;\
char* border=" ";\
const belle_sip_list_t* list;\
current_offset+=belle_sip_header_marshal(BELLE_SIP_HEADER(header), buff,current_offset, buff_size);\
const belle_sip_list_t* list=belle_sip_parameters_get_parameters(&header->params_list);\
list=belle_sip_parameters_get_parameters(&header->params_list);\
if (header->scheme) { \
current_offset+=snprintf(buff+current_offset,buff_size-current_offset," %s",header->scheme);\
} else { \
......
......@@ -53,6 +53,12 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.0.1"
#endif
#endif
/*etc*/
......@@ -212,9 +218,7 @@ extern "C" {
belle_sip_list_t *belle_sip_list_new(void *data);
belle_sip_list_t* belle_sip_list_append_link(belle_sip_list_t* elem,belle_sip_list_t *new_elem);
belle_sip_list_t *belle_sip_list_find_custom(belle_sip_list_t *list, belle_sip_compare_func compare_func, const void *user_data);
belle_sip_list_t *belle_sip_list_delete_custom(belle_sip_list_t *list, belle_sip_compare_func compare_func, const void *user_data);
belle_sip_list_t * belle_sip_list_free(belle_sip_list_t *list);
#define belle_sip_list_next(elem) ((elem)->next)
......@@ -298,7 +302,7 @@ char *belle_sip_strdup_printf(const char *fmt,...);
#define ATO_(type,value) ATO_##type(value)
#define ATO_int(value) atoi(value)
#define ATO_float(value) strtof(value,NULL)
#define ATO_float(value) (float)strtod(value,NULL)
#define FORMAT_(type) FORMAT_##type
#define FORMAT_int "%i"
#define FORMAT_float "%f"
......@@ -344,6 +348,7 @@ belle_sip_##object_type##_t* belle_sip_##object_type##_parse (const char* value)
pbelle_sip_messageLexer lex; \
pANTLR3_COMMON_TOKEN_STREAM tokens; \
pbelle_sip_messageParser parser; \
belle_sip_##object_type##_t* l_parsed_object; \
input = antlr3NewAsciiStringCopyStream (\
(pANTLR3_UINT8)value,\
(ANTLR3_UINT32)strlen(value),\
......@@ -351,7 +356,7 @@ belle_sip_##object_type##_t* belle_sip_##object_type##_parse (const char* value)
lex = belle_sip_messageLexerNew (input);\
tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT, TOKENSOURCE(lex));\
parser = belle_sip_messageParserNew (tokens);\
belle_sip_##object_type##_t* l_parsed_object = parser->object_type(parser);\
l_parsed_object = parser->object_type(parser);\
parser ->free(parser);\
tokens ->free(tokens);\
lex ->free(lex);\
......@@ -701,6 +706,7 @@ belle_sdp_##object_type##_t* belle_sdp_##object_type##_parse (const char* value)
pbelle_sdpLexer lex; \
pANTLR3_COMMON_TOKEN_STREAM tokens; \
pbelle_sdpParser parser; \
belle_sdp_##object_type##_t* l_parsed_object; \
input = antlr3NewAsciiStringCopyStream (\
(pANTLR3_UINT8)value,\
(ANTLR3_UINT32)strlen(value),\
......@@ -708,7 +714,7 @@ belle_sdp_##object_type##_t* belle_sdp_##object_type##_parse (const char* value)
lex = belle_sdpLexerNew (input);\
tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT, TOKENSOURCE(lex));\
parser = belle_sdpParserNew (tokens);\
belle_sdp_##object_type##_t* l_parsed_object = parser->object_type(parser).ret;\
l_parsed_object = parser->object_type(parser).ret;\
parser ->free(parser);\
tokens ->free(tokens);\
lex ->free(lex);\
......@@ -790,7 +796,6 @@ struct belle_sip_auth_event {
char* ha1;
};
belle_sip_auth_event_t* belle_sip_auth_event_create(const char* realm,const char* username);
void belle_sip_auth_event_destroy(belle_sip_auth_event_t* event);
/*
* refresher
......
......@@ -336,9 +336,10 @@ void belle_sip_main_loop_iterate(belle_sip_main_loop_t *ml){
}
if (min_time_ms!=(uint64_t)-1 ){
int64_t diff;
/* compute the amount of time to wait for shortest timeout*/
cur=belle_sip_time_ms();
int64_t diff=min_time_ms-cur;
diff=min_time_ms-cur;
if (diff>0)
duration=(int)diff;
else
......
......@@ -439,7 +439,7 @@ scope { belle_sip_header_contact_t* prev;}
@init { if ($header_contact::current == NULL) {
$header_contact::current = belle_sip_header_contact_new();
$header_contact::first = $header_contact::current;
$contact_param::prev==NULL;
$contact_param::prev=NULL;
} else {
$contact_param::prev=$header_contact::current;
belle_sip_header_set_next(BELLE_SIP_HEADER($header_contact::current),(belle_sip_header_t*)belle_sip_header_contact_new());
......@@ -453,7 +453,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ( $contact_param::prev == NULL) {
$header_contact::first==NULL;
$header_contact::first=NULL;
} else {
belle_sip_header_set_next(BELLE_SIP_HEADER($contact_param::prev),NULL);
}
......@@ -832,7 +832,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ( $srv_route::prev == NULL) {
$header_service_route::first==NULL;
$header_service_route::first=NULL;
} else {
belle_sip_header_set_next(BELLE_SIP_HEADER($srv_route::prev),NULL);
}
......@@ -870,7 +870,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ( $rec_route::prev == NULL) {
$header_record_route::first==NULL;
$header_record_route::first=NULL;
} else {
belle_sip_header_set_next(BELLE_SIP_HEADER($rec_route::prev),NULL);
}
......@@ -923,7 +923,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ( $route_param::prev == NULL) {
$header_route::first==NULL;
$header_route::first=NULL;
} else {
belle_sip_header_set_next(BELLE_SIP_HEADER($route_param::prev),NULL);
}
......@@ -1008,8 +1008,9 @@ scope { belle_sip_header_via_t* prev;}
$header_via::first = $header_via::current = belle_sip_header_via_new();
$via_parm::prev=NULL;
} else {
belle_sip_header_t* header;
$via_parm::prev=$header_via::current;
belle_sip_header_t* header = BELLE_SIP_HEADER($header_via::current);
header = BELLE_SIP_HEADER($header_via::current);
belle_sip_header_set_next(header,(belle_sip_header_t*)($header_via::current = belle_sip_header_via_new()));
}
}
......@@ -1018,7 +1019,7 @@ catch [ANTLR3_MISMATCHED_TOKEN_EXCEPTION]
{
belle_sip_message("[\%s] reason [\%s]",(const char*)EXCEPTION->name,(const char*)EXCEPTION->message);
if ( $via_parm::prev == NULL) {
$header_via::first==NULL;
$header_via::first=NULL;
} else {
belle_sip_header_set_next(BELLE_SIP_HEADER($via_parm::prev),NULL);
}
......@@ -1279,7 +1280,7 @@ mark : '-' | '_' | '.' | '!' | '~' | STAR | '\'' ;
HEX_CHAR: 'a'..'f' |'A'..'F';
DIGIT : '0'..'9' ;
CRLF : '\r\n' { USER1 = (int)(ctx->pLexer->input->currentLine - ctx->pLexer->input->data); /*GETCHARINDEX()*/;};
CRLF : '\r\n' { USER1 = (int)((char*)ctx->pLexer->input->currentLine - (char*)ctx->pLexer->input->data); /*GETCHARINDEX()*/;};
......
......@@ -72,6 +72,7 @@ unsigned int belle_sip_parameters_is_parameter(const belle_sip_parameters_t* par
}
void belle_sip_parameters_set_parameter(belle_sip_parameters_t* params,const char* name,const char* value) {
/*1 check if present*/
belle_sip_param_pair_t* lNewpair;
belle_sip_list_t * lResult = belle_sip_list_find_custom(params->paramnames_list, (belle_sip_compare_func)strcmp, name);
/* first remove from header names list*/
if (lResult) {
......@@ -84,7 +85,7 @@ void belle_sip_parameters_set_parameter(belle_sip_parameters_t* params,const cha
params->param_list=belle_sip_list_delete_link(params->param_list,lResult);
}
/* 2 insert*/
belle_sip_param_pair_t* lNewpair = belle_sip_param_pair_new(name,value);
lNewpair = belle_sip_param_pair_new(name,value);
params->param_list=belle_sip_list_append(params->param_list,lNewpair);
params->paramnames_list=belle_sip_list_append(params->paramnames_list,lNewpair->name);
}
......@@ -106,7 +107,7 @@ void belle_sip_parameters_remove_parameter(belle_sip_parameters_t* params,const
params->param_list=belle_sip_list_delete_link(params->param_list,lResult);
}
} else {
belle_sip_warning("cannot remove param \%s because not present",name);
belle_sip_warning("cannot remove param %s because not present",name);
}
}
......@@ -146,8 +146,19 @@ static void __belle_sip_logv_out(belle_sip_log_level lev, const char *fmt, va_li
}
msg=belle_sip_strdup_vprintf(fmt,args);
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
#ifndef _UNICODE
OutputDebugString(msg);
OutputDebugString("\r\n");
#else
{
int len=strlen(msg);
wchar_t *tmp=(wchar_t*)belle_sip_malloc((len+1)*sizeof(wchar_t));
mbstowcs(tmp,msg,len);
OutputDebugString(tmp);
OutputDebugString(L"\r\n");
belle_sip_free(tmp);
}
#endif
#endif
fprintf(__log_file,"belle-sip-%s-%s" ENDLINE,lname,msg);
fflush(__log_file);
......@@ -550,7 +561,7 @@ static const char *symbols="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
**/
char * belle_sip_random_token(char *ret, size_t size){
unsigned int val;
int i,j;
unsigned int i,j;
for(i=0,j=0;i<size-1;++i,++j){
if (j%5==0) val=belle_sip_random();
ret[i]=symbols[val & 63];
......
......@@ -25,7 +25,7 @@
#endif
static const int belle_sip_network_buffer_size=65535;
#define belle_sip_network_buffer_size 65535
typedef enum belle_sip_channel_state{
BELLE_SIP_CHANNEL_INIT,
......
......@@ -448,13 +448,15 @@ belle_sip_request_t *belle_sip_dialog_create_ack(belle_sip_dialog_t *obj, unsign
}
belle_sip_request_t *belle_sip_dialog_create_request(belle_sip_dialog_t *obj, const char *method){
belle_sip_request_t *req;
if (obj->state != BELLE_SIP_DIALOG_CONFIRMED && obj->state != BELLE_SIP_DIALOG_EARLY) {
belle_sip_error("Cannot create method [%s] from dialog [%p] in state [%s]",method,obj,belle_sip_dialog_state_to_string(obj->state));
return NULL;
}
if (obj->local_cseq==0) obj->local_cseq=110;
if (strcmp(method,"ACK")!=0) obj->local_cseq++;
belle_sip_request_t *req=belle_sip_request_create(belle_sip_header_address_get_uri(obj->remote_target),
req=belle_sip_request_create(belle_sip_header_address_get_uri(obj->remote_target),
method,
obj->call_id,
belle_sip_header_cseq_create(obj->local_cseq,method),
......
......@@ -181,10 +181,10 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_ist_t)={
belle_sip_ist_t *belle_sip_ist_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
belle_sip_ist_t *obj=belle_sip_object_new(belle_sip_ist_t);
belle_sip_server_transaction_init((belle_sip_server_transaction_t*)obj,prov,req);
belle_sip_transaction_t *base=(belle_sip_transaction_t*)obj;
belle_sip_response_t *resp;
belle_sip_server_transaction_init((belle_sip_server_transaction_t*)obj,prov,req);
base->state=BELLE_SIP_TRANSACTION_PROCEEDING;
resp=belle_sip_response_create_from_request(req,100);
belle_sip_server_transaction_send_response((belle_sip_server_transaction_t*)obj,resp);
......
......@@ -78,6 +78,7 @@ belle_sip_message_t* belle_sip_message_parse_raw (const char* buff, size_t buff_
pbelle_sip_messageLexer lex;
pANTLR3_COMMON_TOKEN_STREAM tokens;
pbelle_sip_messageParser parser;
belle_sip_message_t* l_parsed_object;
input = antlr3NewAsciiStringCopyStream (
(pANTLR3_UINT8)buff,
(ANTLR3_UINT32)buff_length,
......@@ -85,7 +86,7 @@ belle_sip_message_t* belle_sip_message_parse_raw (const char* buff, size_t buff_
lex = belle_sip_messageLexerNew (input);
tokens = antlr3CommonTokenStreamSourceNew (1025, lex->pLexer->rec->state->tokSource);
parser = belle_sip_messageParserNew (tokens);
belle_sip_message_t* l_parsed_object = parser->message_raw(parser,message_length);
l_parsed_object = parser->message_raw(parser,message_length);
/* if (*message_length < buff_length) {*/
/*there is a body*/
/* l_parsed_object->body_length=buff_length-*message_length;
......
......@@ -20,6 +20,8 @@
#ifdef WIN32
#include <process.h>
static int sockets_initd=0;
int belle_sip_init_sockets(void){
......
......@@ -32,8 +32,16 @@
#else
#include <ws2tcpip.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef _MSC_VER
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
#define strcasecmp(a,b) _stricmp(a,b)
#define snprintf _snprintf
#endif
/*AI_NUMERICSERV is not defined for windows XP. Since it is not essential, we define it to 0 (does nothing)*/
#ifndef AI_NUMERICSERV
......@@ -72,8 +80,13 @@ static inline int inet_aton(const char *ip, struct in_addr *p){
return 0;
}
#ifndef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
#endif
#ifndef EINPROGRESS
#define EINPROGRESS WSAEINPROGRESS
#endif
#else
......
......@@ -226,8 +226,10 @@ static int set_expires_from_trans(belle_sip_refresher_t* refresher) {
belle_sip_response_t*response=transaction->last_response;
belle_sip_request_t*request=belle_sip_transaction_get_request(transaction);
belle_sip_header_expires_t* expires_header;
refresher->expires=-1;
belle_sip_header_contact_t* contact_header;
refresher->expires=-1;
if (strcmp("REGISTER",belle_sip_request_get_method(request))==0
|| strcmp("SUBSCRIBE",belle_sip_request_get_method(request))==0) {
......@@ -282,14 +284,14 @@ void belle_sip_refresher_stop(belle_sip_refresher_t* refresher) {
}
}
belle_sip_refresher_t* belle_sip_refresher_new(belle_sip_client_transaction_t* transaction) {
belle_sip_refresher_t* refresher;
if (belle_sip_transaction_get_state(BELLE_SIP_TRANSACTION(transaction)) != BELLE_SIP_TRANSACTION_COMPLETED) {
belle_sip_error("Invalid state [%s] for transaction [%p], should be BELLE_SIP_TRANSACTION_COMPLETED"
,belle_sip_transaction_state_to_string(belle_sip_transaction_get_state(BELLE_SIP_TRANSACTION(transaction)))
,transaction);
return NULL;
}
belle_sip_refresher_t* refresher = (belle_sip_refresher_t*)belle_sip_object_new(belle_sip_refresher_t);
refresher = (belle_sip_refresher_t*)belle_sip_object_new(belle_sip_refresher_t);
refresher->transaction=transaction;
belle_sip_object_ref(transaction);
refresher->listener_callbacks.process_response_event=process_response_event;
......
......@@ -25,7 +25,7 @@ struct belle_sip_udp_listening_point{
static void belle_sip_udp_listening_point_uninit(belle_sip_udp_listening_point_t *lp){
if (lp->sock!=-1) close(lp->sock);
if (lp->sock!=-1) close_socket(lp->sock);
if (lp->source) {
belle_sip_main_loop_remove_source(lp->base.stack->ml,lp->source);
belle_sip_object_unref(lp->source);
......@@ -83,7 +83,7 @@ static belle_sip_socket_t create_udp_socket(const char *addr, int port){
err=bind(sock,res->ai_addr,res->ai_addrlen);
if (err==-1){
belle_sip_error("udp bind() failed for %s port %i: %s",addr,port,strerror(errno));
close(sock);
close_socket(sock);
freeaddrinfo(res);
return -1;
}
......@@ -101,7 +101,7 @@ static int on_udp_data(belle_sip_udp_listening_point_t *lp, unsigned int events)
if (events & BELLE_SIP_EVENT_READ){
belle_sip_message("udp_listening_point: data to read.");
err=recvfrom(lp->sock,(void*)buf,sizeof(buf),MSG_PEEK,(struct sockaddr*)&addr,&addrlen);
err=recvfrom(lp->sock,(char*)buf,sizeof(buf),MSG_PEEK,(struct sockaddr*)&addr,&addrlen);
if (err==-1){
belle_sip_error("udp_listening_point: recvfrom() failed: %s",belle_sip_get_socket_error_string());
}else{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment