Added hardwired MDP listener port for VoMP.

Moved VoMP header material into serval.h for use.
This commit is contained in:
gardners 2012-04-19 07:34:12 +09:30
parent 1a221a32b2
commit 729ede461d
3 changed files with 39 additions and 34 deletions

View File

@ -441,6 +441,8 @@ int overlay_saw_mdp_frame(int interface, overlay_mdp_frame *mdp,long long now)
} else { } else {
/* No socket is bound, ignore the packet ... except for magic sockets */ /* No socket is bound, ignore the packet ... except for magic sockets */
switch(mdp->out.dst.port) { switch(mdp->out.dst.port) {
case MDP_PORT_VOMP:
return vomp_mdp_received(mdp);
case MDP_PORT_KEYMAPREQUEST: case MDP_PORT_KEYMAPREQUEST:
/* Either respond with the appropriate SAS, or record this one if it /* Either respond with the appropriate SAS, or record this one if it
verfies out okay. */ verfies out okay. */
@ -546,6 +548,7 @@ int overlay_mdp_sanitytest_sourceaddr(sockaddr_mdp *src,int userGeneratedFrameP,
break; break;
/* other built-in listeners */ /* other built-in listeners */
case MDP_PORT_KEYMAPREQUEST: case MDP_PORT_KEYMAPREQUEST:
case MDP_PORT_VOMP:
return 0; return 0;
default: default:
break; break;

View File

@ -1089,6 +1089,7 @@ unsigned char *keyring_get_nm_bytes(sockaddr_mdp *priv,sockaddr_mdp *pub);
#define MDP_PORT_ECHO 7 #define MDP_PORT_ECHO 7
#define MDP_PORT_KEYMAPREQUEST 0x10000001 #define MDP_PORT_KEYMAPREQUEST 0x10000001
#define MDP_PORT_VOMP 0x10000002
#define MDP_TYPE_MASK 0xff #define MDP_TYPE_MASK 0xff
#define MDP_FLAG_MASK 0xff00 #define MDP_FLAG_MASK 0xff00
@ -1185,3 +1186,38 @@ void *_serval_debug_malloc(unsigned int bytes,char *file,const char *func,int li
void *_serval_debug_calloc(unsigned int bytes,unsigned int count,char *file,const char *func,int line); void *_serval_debug_calloc(unsigned int bytes,unsigned int count,char *file,const char *func,int line);
void _serval_debug_free(void *p,char *file,const char *func,int line); void _serval_debug_free(void *p,char *file,const char *func,int line);
#endif #endif
typedef struct vomp_call_half {
unsigned char sid[SID_SIZE];
unsigned char state;
unsigned char codec;
unsigned int session;
#define VOMP_SESSION_MASK 0xffffff
unsigned int sequence;
/* the following is from call creation, not start of audio flow */
unsigned long long milliseconds_since_call_start;
} vomp_call_half;
typedef struct vomp_call_state {
vomp_call_half local;
vomp_call_half remote;
int ringing;
unsigned long long last_activity;
int audio_started;
} vomp_call_state;
#define VOMP_CODEC_CODEC2_2400 0x01
#define VOMP_CODEC_CODEC2_1400 0x02
#define VOMP_CODEC_GSM 0x03
#define VOMP_CODEC_DTMF 0x04
#define VOMP_CODEC_ENGAGED 0x05
#define VOMP_CODEC_CODECSISUPPORT 0xfe
#define VOMP_CODEC_CHANGEYOURCODECTO 0xff
#define VOMP_STATE_NOCALL 1
#define VOMP_STATE_CALLPREP 2
#define VOMP_STATE_RINGINGOUT 3
#define VOMP_STATE_RINGINGIN 4
#define VOMP_STATE_INCALL 5
#define VOMP_STATE_CALLENDED 6

34
vomp.c
View File

@ -25,40 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "serval.h" #include "serval.h"
typedef struct vomp_call_half {
unsigned char sid[SID_SIZE];
unsigned char state;
unsigned char codec;
unsigned int session;
#define VOMP_SESSION_MASK 0xffffff
unsigned int sequence;
/* the following is from call creation, not start of audio flow */
unsigned long long milliseconds_since_call_start;
} vomp_call_half;
typedef struct vomp_call_state {
vomp_call_half local;
vomp_call_half remote;
int ringing;
unsigned long long last_activity;
int audio_started;
} vomp_call_state;
#define VOMP_CODEC_CODEC2_2400 0x01
#define VOMP_CODEC_CODEC2_1400 0x02
#define VOMP_CODEC_GSM 0x03
#define VOMP_CODEC_DTMF 0x04
#define VOMP_CODEC_ENGAGED 0x05
#define VOMP_CODEC_CODECSISUPPORT 0xfe
#define VOMP_CODEC_CHANGEYOURCODECTO 0xff
#define VOMP_STATE_NOCALL 1
#define VOMP_STATE_CALLPREP 2
#define VOMP_STATE_RINGINGOUT 3
#define VOMP_STATE_RINGINGIN 4
#define VOMP_STATE_INCALL 5
#define VOMP_STATE_CALLENDED 6
/* Although we only support one call at a time, we allow for multiple call states. /* Although we only support one call at a time, we allow for multiple call states.
This is partly to deal with denial of service attacks that might occur by causing This is partly to deal with denial of service attacks that might occur by causing
the ejection of newly allocated session numbers before the caller has had a chance the ejection of newly allocated session numbers before the caller has had a chance