q931ie.h
上传用户:hnnddl
上传日期:2007-01-06
资源大小:3580k
文件大小:10k
源码类别:

IP电话/视频会议

开发平台:

WINDOWS

  1. /*
  2.  * $Revision: 1.8 $
  3.  * $Date: 1999/03/30 21:55:47 $
  4.  */
  5. ////////////////////////////////////////////////////////////////
  6. //               Copyright (c) 1996,97 Lucent Technologies    //
  7. //                       All Rights Reserved                  //
  8. //                                                            //
  9. //                       THIS IS UNPUBLISHED                  //
  10. //                       PROPRIETARY SOURCE                   //
  11. //                   CODE OF Lucent Technologies              //
  12. //      AND elemedia    //
  13. //                                                            //
  14. //           The copyright notice above does not evidence any //
  15. //          actual or intended publication of such source code//
  16. ////////////////////////////////////////////////////////////////
  17. //
  18. ////////////////////////////////////////////////////////////////
  19. // File : q931ie.h   //
  20. //                                                            //
  21. // The Q931 information element class       //
  22. //   //
  23. // History:   //
  24. //  18_Dec_1996 Created   //
  25. //  28_Apr_1997 Code Review PASS2    //
  26. // 08_Jul_1997 Merged Sun5 changes.   //
  27. // 18_Aug_1997 Added Q931CalledPartyNumberIE   //
  28. // 08_Apr_1998 Q931DisplayIE added.   //
  29. // 12_Oct_1998 Q931KeypadFacilityIE added.   //
  30. //   //
  31. ////////////////////////////////////////////////////////////////
  32. #if !defined(__Q931IE_H__)
  33. #define __Q931IE_H__
  34. #include "util/listifc.h"
  35. #include "util/platform.h"
  36. #include "api/apierr.h"
  37. enum Q931CodingStd
  38. {
  39. CS_CCITT = 0, // CCITT(ITU-T) standardized coding
  40. CS_ISO = 1, // ISO/IEC standard
  41. CS_NS = 2, // National standard
  42. CS_LOC = 3 // standard specific to identified loction
  43. };
  44. enum Q931ProgressIndicatorLoc
  45. {
  46. LOC_USER = 0x0, // user
  47. LOC_PRIV_NET_LOCAL_USER = 0x1, // private n/w serving the local user
  48. LOC_PUB_NET_LOCAL_USER = 0x2, // public n/w serving the local user
  49. LOC_TRANSIT_NET = 0x3, // Transit n/w
  50. LOC_PUB_NET_REMOTE_USER = 0x4, // public n/w serving the remote user
  51. LOC_PRIV_NET_REMOTE_USER = 0x5, // private n/w serving the remote user
  52. LOC_BEYOND_IW_POINT = 0xA // n/w beyond the interworking point
  53. };
  54. enum Q931ProgressDesc
  55. {
  56. DESC_NOT_END_TO_END_ISDN = 0x1, // Call is not end-to-end ISDN
  57. DESC_DEST_ADDR_NON_ISDN = 0x2, // Destination address in non ISDN
  58. DESC_ORIG_ADDR_NON_ISDN = 0x3, // Origination address is non ISDN
  59. DESC_CALL_RETURNED_TO_ISDN = 0x4, // Call has returned to the ISDN
  60. DESC_IW_OCCURRED = 0x5, // Interworking has occurred
  61. DESC_INBAND_INFO_AVAIL = 0x8 // inband info available
  62. };
  63. enum Q931CauseValues
  64. {
  65. CAUSE_NO_ROUTE_TO_DESTINATION = 0x03,
  66. CAUSE_NORMAL_CALL_CLEARING = 0x10,
  67. CAUSE_USER_BUSY = 0x11,
  68. CAUSE_NO_USER_RESPONDING = 0x12, // New: 10/15/1998 Release
  69. CAUSE_USER_ALERTING_NO_ANSWER = 0x13,
  70. CAUSE_CALL_REJECTED = 0x15,
  71. CAUSE_INVALID_NUMBER_FORMAT = 0x1C,
  72. CAUSE_FACILITY_REJECTED = 0x3D,
  73. CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 0x1E,
  74. CAUSE_NORMAL_UNSPECIFIED = 0x1F,
  75. CAUSE_NO_CIRCUIT_OR_CHANNEL_AVAILABLE = 0x22,
  76. CAUSE_TEMPORARY_FAILURE = 0x29,
  77. CAUSE_SWITCHING_EQUIPMENT_CONGESTION = 0x2A,
  78. CAUSE_RESOURCE_UNAVAILABLE_OR_UNSPECIFIED = 0x2F,
  79. CAUSE_CHANNEL_TYPE_NOT_IMPLEMENTED = 0x42, // New: 10/15/1998 Release
  80. CAUSE_INCOMPATIBLE_DESTINATION = 0x58,
  81. CAUSE_MANDATORY_IE_MISSING = 0x60,
  82. CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 0x61,
  83. CAUSE_IE_NO_EXISTENT = 0x63,
  84. CAUSE_INVALID_IE_CONTENT = 0x64,
  85. CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_CALL_STATE = 0x65
  86. };
  87. // -enum Q931CauseCodingStandards
  88. //
  89. // @Version: PX3230S Version 2.3.2 
  90. //
  91. // @Caveat:
  92. // Coding standards other than CAUSE_CODING_STANDARD_ITU_T should be used 
  93. // only when the desired cause value cannot be represented with the 
  94. // ITU-T-standardized coding.
  95. // @See:
  96. // -H225CSCauseIE 
  97. enum Q931CauseCodingStandards
  98. {
  99. CAUSE_CODING_STANDARD_ITU_T = 0x0, //ITU-T standardized coding
  100. CAUSE_CODING_STANDARD_ISO_IEC = 0x1,//ISO/IEC standard 
  101. CAUSE_CODING_STANDARD_NATIONAL_STANDARD = 0x2,//national standard 
  102. CAUSE_CODING_STANDARD_SPECIFIC = 0x3//standard specific to identified location
  103. };
  104. // -enum Q931CauseLocations
  105. //
  106. // @Version: PX3230S Version 2.3.2 
  107. //
  108. // @See:
  109. // -H225CSCauseIE 
  110. enum Q931CauseLocations
  111. {
  112. CAUSE_LOCATION_USER = 0x0, // user (U)
  113. CAUSE_LOCATION_LPN = 0x1, // private network serving the local user (LPN)
  114. CAUSE_LOCATION_LN = 0x2, // public network serving the local user (LN)
  115. CAUSE_LOCATION_TN = 0x3, // transit network (TN)
  116. CAUSE_LOCATION_RLN = 0x4, // public network serving the remote user (RLN)
  117. CAUSE_LOCATION_RPN = 0x5, // private network serving the remote user (RPN)
  118. CAUSE_LOCATION_INTL = 0x7, // international network (INTL)
  119. CAUSE_LOCATION_BI = 0xA, // network beyond interworking point (BI)
  120. CAUSE_LOCATION_NTL_RSVD_1 = 0xC, // reserved for national use
  121. CAUSE_LOCATION_NTL_RSVD_2 = 0xD, // reserved for national use
  122. CAUSE_LOCATION_NTL_RSVD_3 = 0xE, // reserved for national use
  123. CAUSE_LOCATION_NTL_RSVD_4 = 0xF //reserved for national use
  124. };
  125. enum Q931NumberType
  126. {
  127. NUMBERTYPE_UNKNOWN = 0x0,
  128. NUMBERTYPE_INTERNATIONAL = 0x1,
  129. NUMBERTYPE_NATIONAL = 0x2,
  130. NUMBERTYPE_NETWORK_SPECIFIC = 0x3,
  131. NUMBERTYPE_SUBSCRIBER = 0x4,
  132. NUMBERTYPE_ABBREVIATED = 0x5
  133. };
  134. enum Q931NumberingPlan
  135. {
  136. NUMBERINGPLAN_UNKNOWN = 0x0,
  137. NUMBERINGPLAN_ISDN = 0x1,
  138. NUMBERINGPLAN_DATA = 0x3,
  139. NUMBERINGPLAN_TELEX = 0x4,
  140. NUMBERINGPLAN_NATIONAL_STANDARD = 0x8,
  141. NUMBERINGPLAN_PRIVATE = 0x9
  142. };
  143. class Logger;
  144. // information element class.
  145. class DLLEXPORT Q931IE : public ListElementInterface
  146. {
  147. public:
  148. Q931IE(int length_field = 1);
  149. virtual ~Q931IE();
  150. virtual int Match(void *key, unsigned long context);
  151. virtual ProtReturnCode GetID(int& id);
  152. // Upon successful return buf will contain the 
  153. // complete information element image that begins
  154. // with id, and is followed by length and data.
  155. // length indicates the  number of valid bytes in
  156. // buf.
  157. virtual ProtReturnCode GetRaw(char *buf, int& length);
  158. // Get the length in octets of the complete ie.
  159. virtual ProtReturnCode GetRawLength(int &length);
  160. // Set the entire information element. Buf contains
  161. // the complete information element image,
  162. // that includes the id, length etc.
  163. // If buf contains more than one information
  164. // element, only the first one is processed and
  165. // length indicates the number of bytes that were processed.
  166. virtual ProtReturnCode SetRaw(char *buf, int& length);
  167. // Get contents of the ie.
  168. virtual ProtReturnCode GetContent(char *data, 
  169. int &length);
  170. // Get the length in octets of the ie contents alone.
  171. virtual ProtReturnCode GetContentLength(int &length);
  172. // buf contains the contents alone, id specifies the
  173. // information element id and length specifies the 
  174. // length of the contents.
  175. virtual ProtReturnCode SetContent(int id, char *buf, int length);
  176. // buf contains the contents alone, information element
  177. // id is implicit.
  178. // This method will be implemented by classes which
  179. // derive from Q931IE class to implement specific
  180. // IEs like IE_DISPLAY, IE_REASON or H225UserToUserIE.
  181. virtual ProtReturnCode Set(char *buf, int length);
  182. Q931IE& operator=(Q931IE& ie);
  183. // For Protocol internal use..
  184. virtual void Dump(Logger *logger);
  185. protected:
  186. // the information element as a byte stream.
  187. char *data;
  188. // total length of the information element byte stream.
  189. int total_length;
  190. // length of the information element data portion.
  191. int content_length;
  192. // Length of the length field contents
  193. int length_field;
  194. static int is_fixed_length_ie(int id)
  195. {
  196. return (int) (((unsigned char) id) & 0x80);
  197. }
  198. private:
  199. virtual ProtReturnCode Copy(Q931IE& ie);
  200. };
  201. class DLLEXPORT Q931CauseIE : public Q931IE
  202. {
  203. public:
  204. Q931CauseIE();
  205. // method to set/get the cause information element.
  206. virtual ProtReturnCode SetCause(unsigned char cause_value);
  207. virtual ProtReturnCode GetCause(unsigned char& cause_value);
  208. Q931CauseIE& operator=(Q931CauseIE&);
  209. };
  210. class DLLEXPORT Q931PartyNumberIE : public Q931IE
  211. {
  212. public:
  213. // ie_type is IE_CALLED_PARTY_NUMBER or
  214. // IE_CALLING_PARTY_NUMBER
  215. Q931PartyNumberIE(int ie_type);
  216. // Methods to set/get the type and plan of the number.
  217. // see enum Q931NumberType and Q931NumberingPlan
  218. virtual ProtReturnCode SetNumberParams(int type,int plan);
  219. virtual ProtReturnCode GetNumberParams(int& type,int& plan);
  220. // Methods to set/get the IA5 characters(digits) in the 
  221. // number.
  222. virtual ProtReturnCode SetDigits(char *digits, int length);
  223. virtual ProtReturnCode GetDigitsLength(int& length);
  224. virtual ProtReturnCode GetDigits(char *digits, int& length);
  225. Q931PartyNumberIE& operator=(Q931PartyNumberIE&);
  226. private:
  227. int ie_type;
  228. };
  229. class DLLEXPORT Q931CalledPartyNumberIE : public Q931PartyNumberIE
  230. {
  231. public:
  232. Q931CalledPartyNumberIE();
  233. Q931CalledPartyNumberIE& operator=(Q931CalledPartyNumberIE&);
  234. };
  235. class DLLEXPORT Q931CallingPartyNumberIE : public Q931PartyNumberIE
  236. {
  237. public:
  238. Q931CallingPartyNumberIE();
  239. Q931CallingPartyNumberIE& operator=(Q931CallingPartyNumberIE&);
  240. };
  241. class DLLEXPORT Q931DisplayIE  : public Q931IE
  242. {
  243. public:
  244. Q931DisplayIE();
  245. virtual ~Q931DisplayIE();
  246. ProtReturnCode SetDisplayString(char *str, int length);
  247. ProtReturnCode GetDisplayStringLength(int& length);
  248. ProtReturnCode GetDisplayString(char *str, int& length);
  249. Q931DisplayIE& operator=(Q931DisplayIE&);
  250. };
  251. //
  252. // This class encapsulates the Q931 Keypad Facility Information
  253. // element.
  254. //
  255. // @See:
  256. // -Q931IE
  257. //
  258. // @Version: PX3230S Version 2.2 
  259. class DLLEXPORT Q931KeypadFacilityIE : public Q931IE
  260. {
  261. public:
  262. Q931KeypadFacilityIE();
  263. virtual ~Q931KeypadFacilityIE();
  264. // Method for setting Keypad information as an IA5 string.
  265. ProtReturnCode SetKeypadInfo(char *ia5str, int length);
  266. // Method for getting the length of the keypad information.
  267. ProtReturnCode GetKeypadInfoLength(int& length);
  268. // Method to retrieve the keypad information string.
  269. // ia5str must point to buffer of size 'length'. Upon
  270. // return from this method, length will contains the actual
  271. // number of bytes written to the buffer pointed to by
  272. // ia5str.
  273. ProtReturnCode GetKeypadInfo(char *ia5str, int& length);
  274. Q931KeypadFacilityIE& operator=(Q931KeypadFacilityIE&);
  275. };
  276. #endif //__Q931IE_H__