fix msvc compilation with C compiler

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@324 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
aymeric 2009-03-10 02:47:33 +00:00
parent a6beab6bf9
commit abb347773d
5 changed files with 380 additions and 369 deletions

View file

@ -29,6 +29,7 @@ extern MSFilterDesc ms_conf_desc;
extern MSFilterDesc ms_join_desc; extern MSFilterDesc ms_join_desc;
extern MSFilterDesc ms_resample_desc; extern MSFilterDesc ms_resample_desc;
extern MSFilterDesc ms_volume_desc; extern MSFilterDesc ms_volume_desc;
extern MSFilterDesc ms_ice_desc;
MSFilterDesc * ms_filter_descs[]={ MSFilterDesc * ms_filter_descs[]={
&ms_alaw_dec_desc, &ms_alaw_dec_desc,
&ms_alaw_enc_desc, &ms_alaw_enc_desc,
@ -61,6 +62,7 @@ MSFilterDesc * ms_filter_descs[]={
&ms_resample_desc, &ms_resample_desc,
#endif #endif
&ms_volume_desc, &ms_volume_desc,
&ms_ice_desc,
NULL NULL
}; };

View file

@ -63,8 +63,6 @@ EXPORTS
ms_list_remove ms_list_remove
ms_filter_set_notify_callback ms_filter_set_notify_callback
ice_sound_send_stun_request
ice_process_stun_message
ms_discover_mtu ms_discover_mtu
ms_set_mtu ms_set_mtu

View file

@ -365,6 +365,10 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> >
</Filter> </Filter>
<File
RelativePath=".\mediastreamer2.def"
>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View file

@ -394,6 +394,8 @@ the method index (_cnt_) and the argument size */
#define MS_FILTER_SET_MAX_GAIN MS_FILTER_BASE_METHOD(25,int) #define MS_FILTER_SET_MAX_GAIN MS_FILTER_BASE_METHOD(25,int)
#define MS_CONF_SPEEX_PREPROCESS_MIC MS_FILTER_EVENT(MS_CONF_ID, 1, void*) #define MS_CONF_SPEEX_PREPROCESS_MIC MS_FILTER_EVENT(MS_CONF_ID, 1, void*)
#define MS_CONF_CHANNEL_VOLUME MS_FILTER_EVENT(MS_CONF_ID, 3, void*)
#define MS_SPEEX_EC_PREPROCESS_MIC MS_FILTER_EVENT(MS_SPEEX_EC_ID, 1, void*) #define MS_SPEEX_EC_PREPROCESS_MIC MS_FILTER_EVENT(MS_SPEEX_EC_ID, 1, void*)
#define MS_SPEEX_EC_ECHO_STATE MS_FILTER_EVENT(MS_SPEEX_EC_ID, 2, void*) #define MS_SPEEX_EC_ECHO_STATE MS_FILTER_EVENT(MS_SPEEX_EC_ID, 2, void*)
/** @} */ /** @} */

View file

@ -50,10 +50,7 @@ ice_sendtest( struct IceCheckList *checklist, struct CandidatePair *remote_candi
check */ check */
req.hasPriority = TRUE; req.hasPriority = TRUE;
uint32_t type_preference = 110; req.priority.priority = (110 << 24) | (255 << 16) | (255 << 8)
uint32_t interface_preference = 255;
uint32_t stun_priority=255;
req.priority.priority = (type_preference << 24) | (interface_preference << 16) | (stun_priority << 8)
| (256 - remote_candidate->remote_candidate.component_id); | (256 - remote_candidate->remote_candidate.component_id);
/* TODO: put this parameter only for the candidate selected */ /* TODO: put this parameter only for the candidate selected */
@ -611,6 +608,7 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
The password associated with that transport address ID is used to verify The password associated with that transport address ID is used to verify
the MESSAGE-INTEGRITY attribute, if one was present in the request. the MESSAGE-INTEGRITY attribute, if one was present in the request.
*/ */
{
char hmac[20]; char hmac[20];
/* remove length of fingerprint if present */ /* remove length of fingerprint if present */
if (msg.hasFingerprint==TRUE) if (msg.hasFingerprint==TRUE)
@ -639,6 +637,7 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
UInt16 newlen = htons(msg.msgHdr.msgLength); /* add back fingerprint size */ UInt16 newlen = htons(msg.msgHdr.msgLength); /* add back fingerprint size */
memcpy(lenpos, &newlen, sizeof(UInt16)); memcpy(lenpos, &newlen, sizeof(UInt16));
} }
}
/* 7.2.1.1. Detecting and Repairing Role Conflicts */ /* 7.2.1.1. Detecting and Repairing Role Conflicts */
@ -734,6 +733,7 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
} }
} }
{
struct CandidatePair *cand_pair; struct CandidatePair *cand_pair;
int pos; int pos;
cand_pair=NULL; cand_pair=NULL;
@ -879,12 +879,14 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
} }
} }
} }
}
{
UInt32 cookie = 0x2112A442; UInt32 cookie = 0x2112A442;
resp.hasXorMappedAddress = TRUE; resp.hasXorMappedAddress = TRUE;
resp.xorMappedAddress.ipv4.port = remote_addr.port^(cookie>>16); resp.xorMappedAddress.ipv4.port = remote_addr.port^(cookie>>16);
resp.xorMappedAddress.ipv4.addr = remote_addr.addr^cookie; resp.xorMappedAddress.ipv4.addr = remote_addr.addr^cookie;
}
resp.msgHdr.msgType = (STUN_METHOD_BINDING | STUN_SUCCESS_RESP); resp.msgHdr.msgType = (STUN_METHOD_BINDING | STUN_SUCCESS_RESP);
@ -895,10 +897,12 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
/* ? any messageintegrity in response? */ /* ? any messageintegrity in response? */
resp.hasMessageIntegrity = TRUE; resp.hasMessageIntegrity = TRUE;
{
const char serverName[] = "mediastreamer2 " STUN_VERSION; const char serverName[] = "mediastreamer2 " STUN_VERSION;
resp.hasSoftware = TRUE; resp.hasSoftware = TRUE;
memcpy( resp.softwareName.value, serverName, sizeof(serverName)); memcpy( resp.softwareName.value, serverName, sizeof(serverName));
resp.softwareName.sizeValue = sizeof(serverName); resp.softwareName.sizeValue = sizeof(serverName);
}
resp.hasFingerprint = TRUE; resp.hasFingerprint = TRUE;
@ -930,19 +934,22 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
return -1; return -1;
} }
{
UInt32 cookie = 0x2112A442; UInt32 cookie = 0x2112A442;
UInt16 cookie16 = 0x2112A442 >> 16; UInt16 cookie16 = 0x2112A442 >> 16;
mappedAddr.port = resp.xorMappedAddress.ipv4.port^cookie16; mappedAddr.port = resp.xorMappedAddress.ipv4.port^cookie16;
mappedAddr.addr = resp.xorMappedAddress.ipv4.addr^cookie; mappedAddr.addr = resp.xorMappedAddress.ipv4.addr^cookie;
}
{
struct in_addr inaddr; struct in_addr inaddr;
char mapped_addr[64]; char mapped_addr[64];
struct CandidatePair *cand_pair;
int pos;
inaddr.s_addr = htonl (mappedAddr.addr); inaddr.s_addr = htonl (mappedAddr.addr);
snprintf(mapped_addr, sizeof(mapped_addr), snprintf(mapped_addr, sizeof(mapped_addr),
"%s", inet_ntoa (inaddr)); "%s", inet_ntoa (inaddr));
struct CandidatePair *cand_pair;
int pos;
for (pos=0;pos<10 && remote_candidates[pos].remote_candidate.conn_addr[0]!='\0';pos++) for (pos=0;pos<10 && remote_candidates[pos].remote_candidate.conn_addr[0]!='\0';pos++)
{ {
cand_pair = &remote_candidates[pos]; cand_pair = &remote_candidates[pos];
@ -1081,10 +1088,7 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
snprintf(new_pair.local_candidate.conn_addr, sizeof(new_pair.local_candidate.conn_addr), snprintf(new_pair.local_candidate.conn_addr, sizeof(new_pair.local_candidate.conn_addr),
"%s", mapped_addr); "%s", mapped_addr);
uint32_t type_preference = 110; new_pair.remote_candidate.priority = (110 << 24) | (255 << 16) | (255 << 8)
uint32_t interface_preference = 255;
uint32_t stun_priority=255;
new_pair.remote_candidate.priority = (type_preference << 24) | (interface_preference << 16) | (stun_priority << 8)
| (256 - new_pair.remote_candidate.component_id); | (256 - new_pair.remote_candidate.component_id);
snprintf(new_pair.local_candidate.cand_type, sizeof(cand_pair->local_candidate.cand_type), snprintf(new_pair.local_candidate.cand_type, sizeof(cand_pair->local_candidate.cand_type),
@ -1149,8 +1153,10 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
} }
} }
} }
}
else if (STUN_IS_ERR_RESP(msg.msgHdr.msgType)) else if (STUN_IS_ERR_RESP(msg.msgHdr.msgType))
{ {
int pos;
StunMessage resp; StunMessage resp;
memset(&resp, 0, sizeof(StunMessage)); memset(&resp, 0, sizeof(StunMessage));
res = stunParseMessage((char*)mp->b_rptr, mp->b_wptr-mp->b_rptr, res = stunParseMessage((char*)mp->b_rptr, mp->b_wptr-mp->b_rptr,
@ -1161,7 +1167,6 @@ static int ice_process_stun_message(RtpSession *session, struct IceCheckList *ch
return -1; return -1;
} }
int pos;
for (pos=0;pos<10 && remote_candidates[pos].remote_candidate.conn_addr[0]!='\0';pos++) for (pos=0;pos<10 && remote_candidates[pos].remote_candidate.conn_addr[0]!='\0';pos++)
{ {
struct CandidatePair *cand_pair = &remote_candidates[pos]; struct CandidatePair *cand_pair = &remote_candidates[pos];