/usr/include/yate/yategsm.h is in yate-dev 5.4.0-1-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | /**
* yategsm.h
* GSM Radio Layer 3 library
* This file is part of the YATE Project http://YATE.null.ro
*
* Yet Another Telephony Engine - a fully featured software PBX and IVR
* Copyright (C) 2011-2014 Null Team
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing
* information for this specific distribution.
*
* This use of this software may be subject to additional restrictions.
* See the LEGAL file in the main directory for details.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef __YATEGSM_H
#define __YATEGSM_H
#include <yateclass.h>
#include <yatexml.h>
#ifdef _WINDOWS
#ifdef LIBYGSM_EXPORTS
#define YGSM_API __declspec(dllexport)
#else
#ifndef LIBYGSM_STATIC
#define YGSM_API __declspec(dllimport)
#endif
#endif
#endif /* _WINDOWS */
#ifndef YGSM_API
#define YGSM_API
#endif
namespace TelEngine {
class YGSM_API GSML3Codec
{
YNOCOPY(GSML3Codec);
public:
/**
* Codec flags
*/
enum Flags {
XmlDumpMsg = 0x01,
XmlDumpIEs = 0x02,
MSCoder = 0x04,
};
/**
* Codec return status
*/
enum Status {
NoError = 0,
MsgTooShort,
UnknownProto,
ParserErr,
MissingParam,
IncorrectOptionalIE,
IncorrectMandatoryIE,
MissingMandatoryIE,
UnknownMsgType,
};
/**
* Protocol discriminator according to ETSI TS 124 007 V11.0.0, section 11.2.3.1.1
*/
enum Protocol {
GCC = 0x00, // Group Call Control
BCC = 0x01, // Broadcast Call Control
EPS_SM = 0x02, // EPS Session Management
CC = 0x03, // Call Control; Call Related SS messages
GTTP = 0x04, // GPRS Transparent Transport Protocol (GTTP)
MM = 0x05, // Mobility Management
RRM = 0x06, // Radio Resources Management
EPS_MM = 0x07, // EPS Mobility Management
GPRS_MM = 0x08, // GPRS Mobility Management
SMS = 0x09, // SMS
GPRS_SM = 0x0a, // GPRS Session Management
SS = 0x0b, // Non Call Related SS messages
LCS = 0x0c, // Location services
Extension = 0x0e, // reserved for extension of the PD to one octet length
Test = 0x0f, // used by tests procedures described in 3GPP TS 44.014, 3GPP TS 34.109 and 3GPP TS 36.509
Unknown = 0xff,
};
/**
* IE types
*/
enum Type {
NoType = 0,
T,
V,
TV,
LV,
TLV,
LVE,
TLVE,
};
/**
* Type of XML data to generate
*/
enum XmlType {
Skip,
XmlElem,
XmlRoot,
};
/**
* EPS Security Headers
*/
enum EPSSecurityHeader {
PlainNAS = 0x00,
IntegrityProtect = 0x01,
IntegrityProtectCiphered = 0x02,
IntegrityProtectNewEPSCtxt = 0x03,
IntegrityProtectCipheredNewEPSCtxt = 0x04,
ServiceRequestHeader = 0xa0,
};
/**
* Constructor
*/
GSML3Codec(DebugEnabler* dbg = 0);
/**
* Decode layer 3 message payload
* @param in Input buffer containing the data to be decoded
* @param len Length of input buffer
* @param out XmlElement into which the decoded data is returned
* @param params Encoder parameters
* @return Parsing result: 0 (NoError) if succeeded, error status otherwise
*/
unsigned int decode(const uint8_t* in, unsigned int len, XmlElement*& out, const NamedList& params = NamedList::empty());
/**
* Encode a layer 3 message
* @param in Layer 3 message in XML form
* @param out Output buffer into which to put encoded data
* @param params Encoder parameters
* @return Parsing result: 0 (NoError) if succeeded, error status otherwise
*/
unsigned int encode(const XmlElement* in, DataBlock& out, const NamedList& params = NamedList::empty());
/**
* Decode layer 3 message from an existing XML
* @param xml XML which contains layer 3 messages to decode and into which the decoded XML will be put
* @param params Decoder parameters
* @return Parsing result: 0 (NoError) if succeeded, error status otherwise
*/
unsigned int decode(XmlElement* xml, const NamedList& params = NamedList::empty());
/**
* Encode a layer 3 message from an existing XML
* @param xml XML which contains a layer 3 message in XML form. The message will be replaced with its encoded buffer
* @param params Encoder parameters
* @return Parsing result: 0 (NoError) if succeeded, error status otherwise
*/
unsigned int encode(XmlElement* xml, const NamedList& params = NamedList::empty());
/**
* Set data used in debug
* @param enabler The DebugEnabler to use (0 to to use the engine)
* @param ptr Pointer to print, 0 to use the codec pointer
*/
void setCodecDebug(DebugEnabler* enabler = 0, void* ptr = 0);
/**
* Retrieve codec flags
* @return Codec flags
*/
inline uint8_t flags() const
{ return m_flags; }
/**
* Set codec flags
* @param flgs Flags to set
* @param reset Reset flags before setting these ones
*/
inline void setFlags(uint8_t flgs, bool reset = false)
{
if (reset)
resetFlags();
m_flags |= flgs;
}
/**
* Reset codec flags
* @param flgs Flags to reset. If 0, all flags are reset
*/
inline void resetFlags(uint8_t flgs = 0)
{
if (flgs)
m_flags &= ~flgs;
else
m_flags = 0;
}
/**
* Activate printing of debug messages
* @param on True to activate, false to disable
*/
inline void setPrintDbg(bool on = false)
{ m_printDbg = on; }
/**
* Get printing of debug messages flag
* @return True if debugging is activated, false otherwise
*/
inline bool printDbg() const
{ return m_printDbg; }
/**
* Get DebugEnabler used by this codec
* @return DebugEnabler used by the codec
*/
inline DebugEnabler* dbg() const
{ return m_dbg; }
/**
* Retrieve the codec pointer used for debug messages
* @return Codec pointer used for debug messages
*/
inline void* ptr() const
{ return m_ptr; }
/**
* Decode GSM 7bit buffer
* @param buf Input buffer
* @param len Input buffer length
* @param text Destination text
*/
static void decodeGSM7Bit(unsigned char* buf, unsigned int len, String& text);
/**
* Encode GSM 7bit buffer
* @param text Input text
* @param buf Destination buffer
*/
static void encodeGSM7Bit(const String& text, DataBlock& buf);
/**
* IE types dictionary
*/
static const TokenDict s_typeDict[];
/**
* L3 Protocols dictionary
*/
static const TokenDict s_protoDict[];
/**
* EPS Security Headers dictionary
*/
static const TokenDict s_securityHeaders[];
/**
* Errors dictionary
*/
static const TokenDict s_errorsDict[];
private:
unsigned int decodeXml(XmlElement* xml, const NamedList& params, const String& pduTag);
unsigned int encodeXml(XmlElement* xml, const NamedList& params, const String& pduTag);
void printDbg(int dbgLevel, const uint8_t* in, unsigned int len, XmlElement* xml, bool encode = false);
uint8_t m_flags; // Codec flags
// data used for debugging messages
DebugEnabler* m_dbg;
void* m_ptr;
// activate debug
bool m_printDbg;
};
}; // namespace TelEngine
#endif /* __YATEGSM_H */
/* vi: set ts=8 sw=4 sts=4 noet: */
|