Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
e7192283
Commit
e7192283
authored
Jul 18, 2013
by
Ghislain MARY
Browse files
Some changes to only use API allowed for WP8 applications.
parent
581a80f8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
16 deletions
+65
-16
build/windows/belle-sip/belle-sip.vcxproj
build/windows/belle-sip/belle-sip.vcxproj
+4
-4
src/belle_sip_utils.c
src/belle_sip_utils.c
+4
-4
src/dns.c
src/dns.c
+10
-3
src/port.c
src/port.c
+46
-3
src/port.h
src/port.h
+1
-2
No files found.
build/windows/belle-sip/belle-sip.vcxproj
View file @
e7192283
...
...
@@ -66,7 +66,7 @@
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<ClCompile>
<WarningLevel>
Level4
</WarningLevel>
<PreprocessorDefinitions>
WIN32;_DEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<PreprocessorDefinitions>
WIN32;_DEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;
HAVE_ANTLR_STRING_STREAM_NEW;HAVE_COMPILER_TLS;
_CRT_SECURE_NO_WARNINGS;
_UNICODE;UNICODE;
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\antlr3\runtime\C\include;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\..\polarssl\include;$(ProjectDir)..\..\..\..\tunnel\include;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<BasicRuntimeChecks>
Default
</BasicRuntimeChecks>
<PrecompiledHeader>
NotUsing
</PrecompiledHeader>
...
...
@@ -90,7 +90,7 @@
<ClCompile>
<WarningLevel>
Level4
</WarningLevel>
<Optimization>
MaxSpeed
</Optimization>
<PreprocessorDefinitions>
WIN32;NDEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<PreprocessorDefinitions>
WIN32;NDEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;
HAVE_ANTLR_STRING_STREAM_NEW;HAVE_COMPILER_TLS;
_CRT_SECURE_NO_WARNINGS;
_UNICODE;UNICODE;
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\antlr3\runtime\C\include;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\..\polarssl\include;$(ProjectDir)..\..\..\..\tunnel\include;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<StringPooling>
true
</StringPooling>
<BasicRuntimeChecks>
Default
</BasicRuntimeChecks>
...
...
@@ -116,7 +116,7 @@
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
<ClCompile>
<WarningLevel>
Level4
</WarningLevel>
<PreprocessorDefinitions>
WIN32;_DEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;
_CRT_SECURE_NO_WARNINGS;
HAVE_ANTLR_STRING_STREAM_NEW;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<PreprocessorDefinitions>
WIN32;_DEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;HAVE_ANTLR_STRING_STREAM_NEW
;HAVE_COMPILER_TLS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE
;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\antlr3\runtime\C\include;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\..\polarssl\include;$(ProjectDir)..\..\..\..\tunnel\include;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<BasicRuntimeChecks>
Default
</BasicRuntimeChecks>
<PrecompiledHeader>
NotUsing
</PrecompiledHeader>
...
...
@@ -141,7 +141,7 @@
<ClCompile>
<WarningLevel>
Level4
</WarningLevel>
<Optimization>
MaxSpeed
</Optimization>
<PreprocessorDefinitions>
WIN32;NDEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;HAVE_ANTLR_STRING_STREAM_NEW;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<PreprocessorDefinitions>
WIN32;NDEBUG;_WINDOWS;_USRDLL;BELLESIP_EXPORTS;BELLESIP_INTERNAL_EXPORTS;HAVE_POLARSSL;HAVE_TUNNEL;HAVE_ANTLR_STRING_STREAM_NEW;
HAVE_COMPILER_TLS;
_CRT_SECURE_NO_WARNINGS;
_UNICODE;UNICODE;
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\antlr3\runtime\C\include;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\..\polarssl\include;$(ProjectDir)..\..\..\..\tunnel\include;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<StringPooling>
true
</StringPooling>
<BasicRuntimeChecks>
Default
</BasicRuntimeChecks>
...
...
src/belle_sip_utils.c
View file @
e7192283
...
...
@@ -164,15 +164,15 @@ 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
"
);
OutputDebugString
A
(
msg
);
OutputDebugString
A
(
"
\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
"
);
OutputDebugString
W
(
tmp
);
OutputDebugString
W
(
L"
\r\n
"
);
belle_sip_free
(
tmp
);
}
#endif
...
...
src/dns.c
View file @
e7192283
...
...
@@ -694,18 +694,23 @@ static void *dns_sa_addr(int af, void *sa) {
#if _WIN32
static
int
dns_inet_pton
(
int
af
,
const
void
*
src
,
void
*
dst
)
{
union
{
struct
sockaddr_in
sin
;
struct
sockaddr_in6
sin6
;
}
u
;
wchar_t
wsrc
[
MAX
(
INET6_ADDRSTRLEN
,
DNS_D_MAXNAME
)
+
1
];
#ifndef HAVE_C99
int
size_of_u
=
sizeof
u
;
#endif
u
.
sin
.
sin_family
=
af
;
mbstowcs
(
wsrc
,
(
const
char
*
)
src
,
sizeof
(
wsrc
));
#ifdef HAVE_C99
if
(
0
!=
WSAStringToAddress
A
((
void
*
)
src
,
af
,
(
void
*
)
0
,
(
struct
sockaddr
*
)
&
u
,
&
(
int
){
sizeof
u
}))
if
(
0
!=
WSAStringToAddress
W
(
w
src
,
af
,
(
void
*
)
0
,
(
struct
sockaddr
*
)
&
u
,
&
(
int
){
sizeof
u
}))
#else
if
(
0
!=
WSAStringToAddress
A
((
void
*
)
src
,
af
,
(
void
*
)
0
,
(
struct
sockaddr
*
)
&
u
,
&
size_of_u
))
if
(
0
!=
WSAStringToAddress
W
(
w
src
,
af
,
(
void
*
)
0
,
(
struct
sockaddr
*
)
&
u
,
&
size_of_u
))
#endif
{
int
error
=
WSAGetLastError
();
return
-
1
;
}
switch
(
af
)
{
case
AF_INET6
:
...
...
@@ -723,6 +728,7 @@ static int dns_inet_pton(int af, const void *src, void *dst) {
static
const
char
*
dns_inet_ntop
(
int
af
,
const
void
*
src
,
void
*
dst
,
unsigned
long
lim
)
{
union
{
struct
sockaddr_in
sin
;
struct
sockaddr_in6
sin6
;
}
u
;
wchar_t
wdst
[
MAX
(
INET6_ADDRSTRLEN
,
DNS_D_MAXNAME
)
+
1
];
/* NOTE: WSAAddressToString will print .sin_port unless zeroed. */
memset
(
&
u
,
0
,
sizeof
u
);
...
...
@@ -741,9 +747,10 @@ static const char *dns_inet_ntop(int af, const void *src, void *dst, unsigned lo
return
0
;
}
if
(
0
!=
WSAAddressToString
A
((
struct
sockaddr
*
)
&
u
,
dns_sa_len
(
&
u
),
(
void
*
)
0
,
dst
,
&
lim
))
if
(
0
!=
WSAAddressToString
W
((
struct
sockaddr
*
)
&
u
,
dns_sa_len
(
&
u
),
(
void
*
)
0
,
w
dst
,
&
lim
))
return
0
;
wcstombs
((
char
*
)
dst
,
wdst
,
lim
);
return
dst
;
}
/* dns_inet_ntop() */
#else
...
...
src/port.c
View file @
e7192283
...
...
@@ -23,8 +23,8 @@
#include <process.h>
#include <time.h>
#if
n
def
TLS_OUT_OF_INDEXE
S
#define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)
#ifdef
HAVE_COMPILER_TL
S
static
__declspec
(
thread
)
const
void
*
current_thread_data
=
NULL
;
#endif
static
int
sockets_initd
=
0
;
...
...
@@ -64,7 +64,22 @@ const char *belle_sip_get_socket_error_string(){
const
char
*
belle_sip_get_socket_error_string_from_code
(
int
code
){
static
TCHAR
msgBuf
[
256
];
FormatMessage
(
#ifdef _UNICODE
static
WCHAR
wMsgBuf
[
256
];
int
ret
;
FormatMessageW
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_IGNORE_INSERTS
,
NULL
,
code
,
0
,
// Default language
(
LPWSTR
)
&
wMsgBuf
,
sizeof
(
wMsgBuf
),
NULL
);
ret
=
wcstombs
(
msgBuf
,
wMsgBuf
,
sizeof
(
msgBuf
));
if
(
ret
==
sizeof
(
msgBuf
))
msgBuf
[
sizeof
(
msgBuf
)
-
1
]
=
'\0'
;
#else
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_IGNORE_INSERTS
,
NULL
,
...
...
@@ -74,31 +89,59 @@ const char *belle_sip_get_socket_error_string_from_code(int code){
sizeof
(
msgBuf
),
NULL
);
/*FIXME: should convert from TCHAR to UTF8 */
#endif
return
(
const
char
*
)
msgBuf
;
}
int
belle_sip_thread_key_create
(
belle_sip_thread_key_t
*
key
,
void
(
*
destructor
)(
void
*
)
){
#ifdef HAVE_COMPILER_TLS
*
key
=
(
belle_sip_thread_key_t
)
&
current_thread_data
;
#else
*
key
=
TlsAlloc
();
if
(
*
key
==
TLS_OUT_OF_INDEXES
){
belle_sip_error
(
"TlsAlloc(): TLS_OUT_OF_INDEXES."
);
return
-
1
;
}
#endif
return
0
;
}
int
belle_sip_thread_setspecific
(
belle_sip_thread_key_t
key
,
const
void
*
value
){
#ifdef HAVE_COMPILER_TLS
current_thread_data
=
value
;
return
0
;
#else
return
TlsSetValue
(
key
,(
void
*
)
value
)
?
0
:
-
1
;
#endif
}
const
void
*
belle_sip_thread_getspecific
(
belle_sip_thread_key_t
key
){
#ifdef HAVE_COMPILER_TLS
return
current_thread_data
;
#else
return
TlsGetValue
(
key
);
#endif
}
int
belle_sip_thread_key_delete
(
belle_sip_thread_key_t
key
){
#ifdef HAVE_COMPILER_TLS
current_thread_data
=
NULL
;
return
0
;
#else
return
TlsFree
(
key
)
?
0
:
-
1
;
#endif
}
#ifdef WINAPI_FAMILY_PHONE_APP
void
belle_sip_sleep
(
unsigned
int
ms
)
{
HANDLE
sleepEvent
=
CreateEventEx
(
NULL
,
NULL
,
CREATE_EVENT_MANUAL_RESET
,
EVENT_ALL_ACCESS
);
if
(
!
sleepEvent
)
return
;
WaitForSingleObjectEx
(
sleepEvent
,
ms
,
FALSE
);
}
#endif
#else
#include <signal.h>
...
...
src/port.h
View file @
e7192283
...
...
@@ -99,8 +99,7 @@ const char *belle_sip_get_socket_error_string();
const
char
*
belle_sip_get_socket_error_string_from_code
(
int
code
);
#ifdef WINAPI_FAMILY_PHONE_APP
void
WINAPI
Sleep
(
DWORD
ms
);
#define belle_sip_sleep Sleep
BELLESIP_INTERNAL_EXPORT
void
belle_sip_sleep
(
unsigned
int
ms
);
#else
#define belle_sip_sleep Sleep
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment