示例#1
0
文件: bin_scscf.c 项目: asyn/openvims
/**
 * Encode a dialog into a binary form
 * @param x - binary data to append to
 * @param u - the dialog to encode
 * @returns 1 on succcess or 0 on error
 */
int bin_encode_s_dialog(bin_data *x,s_dialog *d)
{
	char ch;
	if (!bin_encode_str(x,&(d->call_id))) goto error;
	ch = d->direction;
	if (!bin_encode_char(x,ch)) goto error;
	
	if (!bin_encode_str(x,&(d->aor))) goto error;
	
	ch = d->method;
	if (!bin_encode_char(x,ch)) goto error;	
	if (!bin_encode_str(x,&(d->method_str))) goto error;
	
	if (!bin_encode_int(x,d->first_cseq)) goto error;	
	if (!bin_encode_int(x,d->last_cseq)) goto error;	

	ch = d->state;
	if (!bin_encode_char(x,ch)) goto error;	

	if (!bin_encode_time_t(x,d->expires)) goto error;
	
	if (!bin_encode_uchar(x,d->is_releasing)) goto error;
	if (!bin_encode_dlg_t(x,d->dialog_c)) goto error;	
	if (!bin_encode_dlg_t(x,d->dialog_s)) goto error;
	return 1;
error:
	LOG(L_ERR,"ERR:"M_NAME":bin_encode_s_dialog: Error while encoding.\n");
	return 0;		
}
示例#2
0
/**
 * Encode an dialog into a binary form
 * @param x - binary data to append to
 * @param u - the dialog to encode
 * @returns 1 on succcess or 0 on error
 */
int bin_encode_p_dialog(bin_data *x,p_dialog *d)
{
	int i;
	char c;
	
	if (!bin_encode_str(x,&(d->call_id))) goto error;
	
	c = d->direction;
	if (!bin_encode_uchar(x,c)) goto error;
	
	if (!bin_encode_str(x,&(d->host))) goto error;
	if (!bin_encode_ushort(x,d->port)) goto error;
	
	c = d->transport;
	if (!bin_encode_uchar(x,c)) goto error;

	if (!bin_encode_ushort(x,d->routes_cnt)) goto error;
	for(i=0;i<d->routes_cnt;i++)
		if (!bin_encode_str(x,d->routes+i)) goto error;
	
	c = d->method;
	if (!bin_encode_uchar(x,c)) goto error;
	if (!bin_encode_str(x,&(d->method_str))) goto error;
	
	if (!bin_encode_int(x,d->first_cseq)) goto error;	
	if (!bin_encode_int(x,d->last_cseq)) goto error;	

	c = d->state;
	if (!bin_encode_uchar(x,c)) goto error;	

	if (!bin_encode_time_t(x,d->expires)) goto error;		
	if (!bin_encode_time_t(x,d->lr_session_expires)) goto error;
	if (!bin_encode_str(x,&(d->refresher))) goto error;
	if (!bin_encode_uchar(x,d->uac_supp_timer)) goto error;
	
	if (!bin_encode_uchar(x,d->is_releasing)) goto error;
	
	if (!bin_encode_str(x,&(d->pcc_session_id))) goto error;
	
	if (!bin_encode_dlg_t(x,d->dialog_c)) goto error;	
	if (!bin_encode_dlg_t(x,d->dialog_s)) goto error;
	
	return 1;
error:
	LOG(L_ERR,"ERR:"M_NAME":bin_encode_p_dialog: Error while encoding.\n");
	return 0;		
}
示例#3
0
文件: bin_scscf.c 项目: asyn/openvims
/**
 * Encode a r_subscriber into a binary form
 * @param x - binary data to append to
 * @param s - the r_subscriber to encode
 * @returns 1 on succcess or 0 on error
 */
int bin_encode_r_subscriber(bin_data *x,r_subscriber *s)
{
	if (!bin_encode_str(x,&(s->subscriber))) goto error;
	if (!bin_encode_char(x,s->event)) goto error;
	if (!bin_encode_time_t(x,s->expires)) goto error;
	if (!bin_encode_dlg_t(x,s->dialog)) goto error;
	if (!bin_encode_int(x,s->version)) goto error;

	return 1;
error:
	LOG(L_ERR,"ERR:"M_NAME":bin_encode_r_subscriber: Error while encoding.\n");
	return 0;		
}
示例#4
0
/**
 * Encode a r_subscription into a binary form
 * @param x - binary data to append to
 * @param p - the r_subscription to encode
 * @returns 1 on succcess or 0 on error
 */
int bin_encode_r_subscription(bin_data *x,r_subscription *s)
{
	char c;
	
	if (!bin_encode_str(x,&(s->req_uri))) goto error;
	if (!bin_encode_int(x,s->duration)) goto error;
	if (!bin_encode_time_t(x,s->expires)) goto error;
	
	c = s->attempts_left;
	if (!bin_encode_char(x,c)) goto error;

	if (!bin_encode_dlg_t(x,s->dialog)) goto error;	
	
	return 1;
error:
	LOG(L_ERR,"ERR:"M_NAME":bin_encode_r_subscription: Error while encoding.\n");
	return 0;		
}