/**@file @brief Elements for Mobility Management messages, GSM 04.08 9.2. */ /* * Copyright 2008 Free Software Foundation, Inc. * Copyright 2010, 2014 Kestrel Signal Processing, Inc. * * This software is distributed under multiple licenses; * see the COPYING file in the main directory for licensing * information for this specific distribuion. * * 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. */ #include #include "GSML3MMElements.h" #include using namespace std; using namespace GSM; void L3CMServiceType::parseV(const L3Frame& src, size_t &rp) { mType = (CMServiceTypeCode)src.readField(rp,4); } ostream& GSM::operator<<(ostream& os, CMServiceTypeCode code) { switch (code) { case L3CMServiceType::MobileOriginatedCall: os << "MOC"; return os; case L3CMServiceType::EmergencyCall: os << "Emergency"; return os; case L3CMServiceType::ShortMessage: os << "SMS"; return os; case L3CMServiceType::SupplementaryService: os << "SS"; return os; case L3CMServiceType::VoiceCallGroup: os << "VGCS"; return os; case L3CMServiceType::VoiceBroadcast: os << "VBS"; return os; case L3CMServiceType::LocationService: os << "LCS"; return os; case L3CMServiceType::MobileTerminatedCall: os << "MTC"; return os; case L3CMServiceType::MobileTerminatedShortMessage: os << "MTSMS"; return os; case L3CMServiceType::TestCall: os << "Test"; return os; case L3CMServiceType::FuzzCallTch: os << "FuzzCallTCH"; return os; case L3CMServiceType::FuzzCallSdcch: os << "FuzzCallSDCCH"; return os; case L3CMServiceType::LocationUpdateRequest: os << "LUR"; return os; case L3CMServiceType::HandoverCall: os << "Handover"; return os; case L3CMServiceType::UndefinedType: break; //default: os << "?" << (int)code << "?"; } os << "invalid:" << (int)code; return os; } void L3CMServiceType::text(ostream& os) const { os << mType; } void L3RejectCause::writeV( L3Frame& dest, size_t &wp ) const { dest.writeField(wp, mRejectCause, 8); } void L3RejectCause::parseV(const L3Frame& src, size_t &rp) { mRejectCause = (RejectCause) src.readField(rp,8); } void L3RejectCause::text(ostream& os) const { os <<"0x"<< hex << mRejectCause << dec; } void L3NetworkName::writeV(L3Frame& dest, size_t &wp) const { unsigned sz = strlen(mName); // header byte if (mAlphabet == ALPHABET_UCS2) { // Ext: 1b, coding scheme: 001b (UCS2), CI, trailing spare bits: 000b (0) dest.writeField(wp,1,1); // ext bit dest.writeField(wp,1,3); // coding scheme USC2 dest.writeField(wp,mCI,1); // show country name? dest.writeField(wp,0,3); // spare bits in last octet // the characters for (unsigned i=0; i