⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rvsdpobjs.c

📁 h.248协议源码
💻 C
📖 第 1 页 / 共 3 页
字号:
	rvSdpTypedTimeConstruct(&x->duration,d_units,duration);
	rvSdpTypedTimeListConstructA(&x->offset,a);
#endif
	return x;
}

RvSdpRepeatInterval *  rvSdpRepeatIntervalConstruct(RvSdpRepeatInterval * x,
							   RvUint32 time,RvSdpTimeUnit t_units,
							   RvUint32 duration ,RvSdpTimeUnit d_units) {
#ifdef RV_SDPTIME_FULL
	rvSdpRepeatIntervalConstructA(x,time,t_units,duration,d_units,&rvDefaultAlloc);
#endif
	return x;
}

RvSdpRepeatInterval *  rvSdpRepeatIntervalConstructCopy(RvSdpRepeatInterval *d,const RvSdpRepeatInterval *s,RvAlloc * alloc) {
#ifdef RV_SDPTIME_FULL
	rvSdpTypedTimeConstruct(&d->interval,rvSdpRepeatIntervalGetIntervalUnits(s),rvSdpRepeatIntervalGetIntervalTime(s));
	rvSdpTypedTimeConstruct(&d->duration,rvSdpRepeatIntervalGetDurationUnits(s),rvSdpRepeatIntervalGetDurationTime(s));
	rvSdpTypedTimeListConstructCopy(&d->offset,&s->offset,alloc);
#endif
	return d;
}

void rvSdpRepeatIntervalDestruct(RvSdpRepeatInterval * x) {
#ifdef RV_SDPTIME_FULL
	rvSdpTypedTimeListDestruct(&x->offset);
#endif
}

RvSdpRepeatInterval *  rvSdpRepeatIntervalCopy(RvSdpRepeatInterval *d,const RvSdpRepeatInterval *s) {
#ifdef RV_SDPTIME_FULL
	rvSdpTypedTimeConstruct(&d->interval,rvSdpRepeatIntervalGetIntervalUnits(s),rvSdpRepeatIntervalGetIntervalTime(s));
	rvSdpTypedTimeConstruct(&d->duration,rvSdpRepeatIntervalGetDurationUnits(s),rvSdpRepeatIntervalGetDurationTime(s));
	rvSdpTypedTimeListCopy(&d->offset,&s->offset);
#endif
	return d;
}

/* Make macro 
RvSdpTimeUnit rvSdpRepeatIntervalGetDurationUnits(const RvSdpRepeatInterval * x) {
	return rvSdpTypedTimeGetUnits(&x->duration);
}
RvUint32 rvSdpRepeatIntervalGetDurationTime(const RvSdpRepeatInterval * x) {
	return rvSdpTypedTimeGetTime(&x->duration);
}

RvSdpTimeUnit rvSdpRepeatIntervalGetIntervalUnits(const RvSdpRepeatInterval * x) {
	return rvSdpTypedTimeGetUnits(&x->interval);
}
RvUint32 rvSdpRepeatIntervalGetIntervalTime(const RvSdpRepeatInterval * x) {
	return rvSdpTypedTimeGetTime(&x->interval);
}


void  rvSdpRepeatIntervalClearOffset(RvSdpRepeatInterval * repeat) {
	rvListClear(RvSdpTypedTime)(&repeat->offset);
}

size_t rvSdpRepeatIntervalGetNumOfOffset(RvSdpRepeatInterval * repeat) {
	return rvListSize(&repeat->offset);
}

RvUint32 rvSdpRepeatIntervalGetOffsetTime(RvSdpRepeatInterval * repeat,size_t i) {
	RvSdpTypedTime * t = rvListAt(RvSdpTypedTime)(&repeat->offset,i);
	return rvSdpTypedTimeGetTime(t);
}

RvSdpTimeUnit rvSdpRepeatIntervalGetOffsetUnits(RvSdpRepeatInterval * repeat,size_t i) {
	RvSdpTypedTime * t = rvVectorAt(RvSdpTypedTime)(&repeat->offset,i);
	return rvSdpTypedTimeGetUnits(t);
}
*/

void rvSdpRepeatIntervalAddOffset(RvSdpRepeatInterval * repeat,RvUint32 time,RvSdpTimeUnit units) {
#ifdef RV_SDPTIME_FULL
	RvSdpTypedTime * t = rvListAllocBack(RvSdpTypedTime)(&repeat->offset);
	rvSdpTypedTimeConstruct(t,units,time);
#endif
}

void rvSdpRepeatIntervalClearOffset(RvSdpRepeatInterval* repeat) {
#ifdef RV_SDPTIME_FULL
	rvListClear(RvSdpTypedTime)(&repeat->offset);
#endif
}

size_t rvSdpRepeatIntervalGetNumOfOffset(RvSdpRepeatInterval* repeat) {
	return rvListSize(&repeat->offset);
}

#ifdef RV_SDPTIME_FULL
RvUint32 rvSdpRepeatIntervalGetOffsetTime(RvSdpRepeatInterval* repeat,size_t i) {
	return rvSdpTypedTimeGetTime(rvListAt(RvSdpTypedTime)(&repeat->offset,i));
}

RvSdpTimeUnit rvSdpRepeatIntervalGetOffsetUnits(RvSdpRepeatInterval* repeat,size_t i) {
	return rvSdpTypedTimeGetUnits(rvListAt(RvSdpTypedTime)(&repeat->offset,i));
}
#endif

/****************************************************************/

RvSdpSessionTime * rvSdpSessionTimeConstructN(RvSdpSessionTime * x,
						 RvUint32 start,RvUint32 end,
						 RvAlloc * alloc) {
	x->start = start;
	x->end = end;
#ifdef RV_SDPTIME_FULL
	rvSdpRepeatIntervalListConstructA(&x->repeat_list,alloc);
#endif
	return x;
}

RvSdpSessionTime * rvSdpSessionTimeConstructCopyA(RvSdpSessionTime *d,const RvSdpSessionTime *s,RvAlloc * alloc) {
	rvSdpSessionTimeConstructA(d,rvSdpSessionTimeGetStart(s),rvSdpSessionTimeGetEnd(s),alloc);	
#ifdef RV_SDPTIME_FULL
	rvSdpRepeatIntervalListConstructCopy(&d->repeat_list,&s->repeat_list,alloc);
#endif
	return d;
}

RvSdpSessionTime * rvSdpSessionTimeConstructCopy(RvSdpSessionTime *d,const RvSdpSessionTime *s) {
	return rvSdpSessionTimeConstructCopyA(d,s,&rvDefaultAlloc);
}

void rvSdpSessionTimeDestruct(RvSdpSessionTime *x) {
#ifdef RV_SDPTIME_FULL
	rvSdpRepeatIntervalListDestruct(&x->repeat_list);
#endif
}

RvSdpSessionTime * rvSdpSessionTimeCopy(RvSdpSessionTime *d,const RvSdpSessionTime *s) {
	d->start = rvSdpSessionTimeGetStart(s);
	d->end = rvSdpSessionTimeGetEnd(s);
#ifdef RV_SDPTIME_FULL
	rvSdpRepeatIntervalListCopy(&d->repeat_list,&s->repeat_list);
#endif
	return d;
}

/* Make macro
const RvUint32 rvSdpSessionTimeGetStart(const RvSdpSessionTime * x) {
	return x->start;
}

const RvUint32 rvSdpSessionTimeGetEnd(const RvSdpSessionTime * x) {
	return x->end ;
}

size_t rvSdpSessionTimeGetNumOfRepeatInterval(const RvSdpSessionTime * x) {
	return rvListSize(&x->repeat_list);
}

RvSdpRepeatInterval * rvSdpSessionTimeGetRepeatInterval(const RvSdpSessionTime * x,size_t i) {
	return rvListAt(RvSdpRepeatInterval)(&x->repeat_list,i);
}
*/

RvSdpRepeatInterval *  rvSdpSessionTimeAddRepeatInterval(RvSdpSessionTime * session,
												  RvUint32 time,RvSdpTimeUnit t_units,
												  RvUint32 duration ,RvSdpTimeUnit d_units) {
#ifdef RV_SDPTIME_FULL
	RvSdpRepeatInterval * repeat = rvListAllocBack(RvSdpRepeatInterval)(&session->repeat_list);
	rvSdpRepeatIntervalConstruct(repeat,time,t_units,duration,d_units);
	return repeat;
#else
	return NULL;
#endif
}

size_t rvSdpSessionTimeGetNumOfRepeatInterval(const RvSdpSessionTime* session) {
#ifdef RV_SDPTIME_FULL
	return rvListSize(&session->repeat_list);
#else
	return 0;
#endif
}

RvSdpRepeatInterval * rvSdpSessionTimeGetRepeatInterval(const RvSdpSessionTime * x,size_t i) {
#ifdef RV_SDPTIME_FULL
	return rvSdpRepeatIntervalListGetElem(&(x)->repeat_list,i);
#else
	return NULL;
#endif
}
/****************************************************************/

RvSdpTimeZoneAdjust * rvSdpTimeZoneAdjustConstructN(RvSdpTimeZoneAdjust * x,RvUint32 time,RvInt32 offset_time,RvSdpTimeUnit offset_units) {
#ifdef RV_SDPTIME_FULL
	x->adjustment_time = time;
	x->offset_units = offset_units;
	x->offset_time = offset_time;
#endif
	return x;
}

RvSdpTimeZoneAdjust * rvSdpTimeZoneAdjustConstructCopy(RvSdpTimeZoneAdjust *d,const RvSdpTimeZoneAdjust *s,RvAlloc * alloc) {
#ifdef RV_SDPTIME_FULL
	rvSdpTimeZoneAdjustConstructA(d,rvSdpTimeZoneAdjustGetTime(s),rvSdpTimeZoneAdjustGetOffsetTime(s),
									rvSdpTimeZoneAdjustGetOffsetUnits(s),alloc);	
#endif
	return d;
}

void rvSdpTimeZoneAdjustDestruct(RvSdpTimeZoneAdjust *x) {
}

/* Use the fact that not memory is actually allocated to set the allocator to NULL */
RvSdpTimeZoneAdjust *  rvSdpTimeZoneAdjustCopy(RvSdpTimeZoneAdjust *d,const RvSdpTimeZoneAdjust *s) {
#ifdef RV_SDPTIME_FULL
	rvSdpTimeZoneAdjustConstructA(d,rvSdpTimeZoneAdjustGetTime(s),rvSdpTimeZoneAdjustGetOffsetTime(s),
									rvSdpTimeZoneAdjustGetOffsetUnits(s),NULL);	
#endif
	return d;
}

/* Make macro
RvUint32 rvSdpTimeZoneAdjustGetTime(const RvSdpTimeZoneAdjust * x) {
	return x->adjustment_time;
}

RvInt32 rvSdpTimeZoneAdjustGetOffsetTime(const RvSdpTimeZoneAdjust * x) {
	return x->offset_time;
}

RvSdpTimeUnit rvSdpTimeZoneAdjustGetOffsetUnits(const RvSdpTimeZoneAdjust * x) {
	return x->offset_units;
}
*/


/******************* Bandwidth methods ********************************/

RvSdpBandwidth * rvSdpBandwidthConstructN(RvSdpBandwidth * x,
										 const char * type,int tlen,int value,RvAlloc* a) {
	rvStringConstructN(&x->type,type,tlen,a);
	x->value = value;
	return x;
}

RvSdpBandwidth * rvSdpBandwidthConstructCopyA(RvSdpBandwidth *d,const RvSdpBandwidth *s,RvAlloc * alloc) {
	rvSdpBandwidthConstructA(d,rvSdpBandwidthGetType(s),rvSdpBandwidthGetValue(s),alloc);		
	return d;
}

RvSdpBandwidth * rvSdpBandwidthConstructCopy(RvSdpBandwidth *d,const RvSdpBandwidth *s) {
	return rvSdpBandwidthConstructCopyA(d,s,&rvDefaultAlloc);
}

void rvSdpBandwidthDestruct(RvSdpBandwidth *x) {
}

RvSdpBandwidth * rvSdpBandwidthCopy(RvSdpBandwidth *d,const RvSdpBandwidth *s) {
	rvStringCopy(&d->type,&s->type);
	d->value = s->value;
	return d;
}

/* Make macro 
const char * rvSdpBandwidthGetType(const RvSdpBandwidth * x) {
	return x->type;
}

RvUint32 rvSdpBandwidthGetValue(const RvSdpBandwidth * x) {
	return x->value;
}
*/

/******************* Connection methods ********************************/

RvSdpConnection * rvSdpConnectionConstructN(RvSdpConnection *connection,
										   RvSdpNetType nettype,
										   RvSdpAddrType addrtype,
										   const char * address,size_t len,RvAlloc * alloc) {
	connection->nettype = nettype;
#ifdef RV_SDPSYMB_USESTRING
	rvStringConstructN(&connection->nettype_str,"",0,alloc);
#endif
	connection->addrtype = addrtype;
#ifdef RV_SDPSYMB_USESTRING
	rvStringConstructN(&connection->addrtype_str,"",0,alloc);
#endif
	rvStringConstructN(&connection->address,address,len,alloc);
	connection->ttl = RV_SDPTTL_NOTSET;
	connection->num_addr = 1;
	return connection;
}

RvSdpConnection * rvSdpConnectionCopy(RvSdpConnection *d,const RvSdpConnection * s) {

	if(s->nettype==RV_SDPNETTYPE_UNKNOWN)
		rvSdpConnectionSetNetTypeStr(d,rvSdpConnectionGetNetTypeStr(s));
	else
		d->nettype = rvSdpConnectionGetNetType(s);
	if(s->addrtype==RV_SDPADDRTYPE_UNKNOWN)
		rvSdpConnectionSetAddrTypeStr(d,rvSdpConnectionGetAddrTypeStr(s));
	else
		d->addrtype = rvSdpConnectionGetAddrType(s);
	rvStringAssign(&d->address,rvSdpConnectionGetAddress(s));

	rvSdpConnectionSetAddressTTL(d,rvSdpConnectionGetAddressTTL(s));
	rvSdpConnectionSetAddressNum(d,rvSdpConnectionGetAddressNum(s));

	return d;
}

RvSdpConnection * rvSdpConnectionConstructCopyA(RvSdpConnection *d,const RvSdpConnection * s,RvAlloc * alloc) {
	rvSdpConnectionConstructA(d,rvSdpConnectionGetNetType(s),rvSdpConnectionGetAddrType(s),
								rvSdpConnectionGetAddress(s),alloc);
	if(s->nettype==RV_SDPNETTYPE_UNKNOWN)
		rvSdpConnectionSetNetTypeStr(d,rvSdpConnectionGetNetTypeStr(s));
	if(s->addrtype==RV_SDPADDRTYPE_UNKNOWN)
		rvSdpConnectionSetAddrTypeStr(d,rvSdpConnectionGetAddrTypeStr(s));

	rvSdpConnectionSetAddressTTL(d,rvSdpConnectionGetAddressTTL(s));
	rvSdpConnectionSetAddressNum(d,rvSdpConnectionGetAddressNum(s));

	return d;
}

RvSdpConnection * rvSdpConnectionConstructCopy(RvSdpConnection *d,const RvSdpConnection * s) {
	return rvSdpConnectionConstructCopyA(d,s,&rvDefaultAlloc);
}

void rvSdpConnectionDestruct(RvSdpConnection *connection) {
	connection->nettype = (RvSdpNetType)RV_SDPFIELD_NOTSET;
	connection->addrtype = (RvSdpAddrType)RV_SDPFIELD_NOTSET;
#ifdef RV_SDPSYMB_USESTRING
	rvStringDestruct(&connection->nettype_str);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -