static OrtpZrtpContext* createUserData(ZrtpContext *context) { OrtpZrtpContext *userData=ortp_new0(OrtpZrtpContext,1); userData->zrtpContext=context; userData->timerWillTriggerAt=0; userData->last_recv_zrtp_seq_number=0; userData->last_sent_zrtp_seq_number=rand()+1; // INT_MAX+1 (signed) userData->srtpRecv=NULL; userData->srtpSend=NULL; ortp_mutex_init(&userData->mutex,NULL); memset(&userData->zrtp_cb,0,sizeof(userData->zrtp_cb)); userData->zrtp_cb.zrtp_activateTimer=&ozrtp_activateTimer; userData->zrtp_cb.zrtp_cancelTimer=&ozrtp_cancelTimer; userData->zrtp_cb.zrtp_handleGoClear=&ozrtp_handleGoClear; userData->zrtp_cb.zrtp_rtpSecretsOn=&ozrtp_rtpSecretsOn; userData->zrtp_cb.zrtp_sendDataZRTP=&ozrtp_sendDataZRTP; userData->zrtp_cb.zrtp_sendInfo=&ozrtp_sendInfo; userData->zrtp_cb.zrtp_srtpSecretsOff=&ozrtp_srtpSecretsOff; userData->zrtp_cb.zrtp_srtpSecretsReady=&ozrtp_srtpSecretsReady; userData->zrtp_cb.zrtp_synchEnter=&ozrtp_synchEnter; userData->zrtp_cb.zrtp_synchLeave=&ozrtp_synchLeave; userData->zrtp_cb.zrtp_zrtpNegotiationFailed=&ozrtp_zrtpNegotiationFailed; userData->zrtp_cb.zrtp_zrtpNotSuppOther=&ozrtp_zrtpNotSuppOther; return userData; }
static OrtpNetworkSimulatorCtx* simulator_ctx_new(void){ OrtpNetworkSimulatorCtx *ctx=(OrtpNetworkSimulatorCtx*)ortp_malloc0(sizeof(OrtpNetworkSimulatorCtx)); qinit(&ctx->latency_q); qinit(&ctx->q); qinit(&ctx->send_q); ortp_mutex_init(&ctx->mutex,NULL); return ctx; }
void ortp_set_log_thread_id(unsigned long thread_id) { if (thread_id == 0) { ortp_logv_flush(); ortp_mutex_destroy(&__log_stored_messages_mutex); } else { ortp_mutex_init(&__log_stored_messages_mutex, NULL); } __log_thread_id = thread_id; }
void rtp_scheduler_init(RtpScheduler *sched) { sched->list=0; sched->time_=0; /* default to the posix timer */ rtp_scheduler_set_timer(sched,&posix_timer); ortp_mutex_init(&sched->lock,NULL); ortp_cond_init(&sched->unblock_select_cond,NULL); sched->max_sessions=sizeof(SessionSet)*8; session_set_init(&sched->all_sessions); sched->all_max=0; session_set_init(&sched->r_sessions); sched->r_max=0; session_set_init(&sched->w_sessions); sched->w_max=0; session_set_init(&sched->e_sessions); sched->e_max=0; }
OrtpEvQueue * ortp_ev_queue_new(){ OrtpEvQueue *q=ortp_new(OrtpEvQueue,1); qinit(&q->q); ortp_mutex_init(&q->mutex,NULL); return q; }