// Q.1970E; RFC 2327 //
#ifndef _IPBCP_H_
#define _IPBCP_H_

typedef struct SdpOrig_struct {
	char			username[16];
	char			session_id[16];
	char			version[8];
	char			network_type[8];
	char			address_type[8];
	char			address[16];
} SdpOrig_struct;

typedef struct SdpConn_struct {
	char			network_type[8];
	char			address_type[8];
	char			address[16];
} SdpConn_struct;

typedef struct SdpTime_struct {
	char			start[16];	//0
	char			stop[16];	//0
} SdpTime_struct;

typedef struct SdpAttrib_struct {
	char			version[8];		//1
	char			type[16];		//"Request"/"Accepted"/"Confused"/"Rejected"
} SdpAttrib_struct;

typedef struct SdpMediaAnn_struct {
	char			media[16];
	char			port[8];
	char			transport[16];
	char			fmt_list[128];
} SdpMediaAnn_struct;

// specify RTP dynamic payload types //
typedef struct SdpMediaAtt_struct {
	char			payload[8];
	char			encoding_name[16];
	char			clock_rate[8];
//	char 			p_time[8];
} SdpMediaAtt_struct;

typedef struct IPBCP_struct {
	char				proto_ver[8];		//Protocol version (M)
	SdpOrig_struct		orig;				//Orign (M)
	char				session_name[16];	//Session name (M)
	SdpConn_struct		conn_data;			//Connection data
	SdpTime_struct		time;				//Time
	SdpAttrib_struct	attrib;				//Session attribute
	SdpMediaAnn_struct	m_ann;				//Media announcement (M)
	SdpMediaAtt_struct	m_att;				//Media attributes
	char 			ptime[8];
} IPBCP_struct;

extern int ipbcp_decode(IPBCP_struct *ipbcp_ptr, const char *ptr);
extern int ipbcp_encode(char *ptr, const IPBCP_struct *ipbcp_ptr);

#endif
