GtpLength_t gtpConvStrToHex(const Buffer *pBuf, U8 *pDst) { LOG_ENTERFN(); U32 begin = 0; U32 indx = 0; /* hex buffer string has odd len, so the first byte of hex buffer * will have 0 as High nibble */ if (GSIM_IS_ODD(pBuf->len)) { pDst[indx++] = 0x0f & gtpCharToHex(pBuf->pVal[0]); begin++; } for (U32 i = begin; i < pBuf->len; i += 2) { U8 HNibble = gtpCharToHex(pBuf->pVal[i]); U8 LNibble = gtpCharToHex(pBuf->pVal[i + 1]); pDst[indx++] = (HNibble << 4) | (LNibble); } LOG_EXITFN(indx); }
GtpLength_t gtpConvStrToHex(const HexString *value, U8 *pDst) { LOG_ENTERFN(); U32 begin = 0; U32 indx = 0; /* hex buffer string has odd len, so the first byte of hex buffer * will have 0 as High nibble */ const char* str = value->c_str(); if (GSIM_IS_ODD(value->size())) { pDst[indx++] = 0x0f & gtpCharToHex(str[0]); begin++; } for (U32 i = begin; i < value->size(); i += 2) { U8 HNibble = gtpCharToHex(str[i]); U8 LNibble = gtpCharToHex(str[i + 1]); pDst[indx++] = (HNibble << 4) | (LNibble); } LOG_EXITFN(indx); }
PRIVATE U8 gtpCharToHex(U8 c) { LOG_ENTERFN(); U8 h = 0; switch (c) { case 'a': h = 0xa; break; case 'b': h = 0xb; break; case 'c': h = 0xc; break; case 'd': h = 0xd; break; case 'e': h = 0xe; break; case 'f': h = 0xf; break; default: h = GSIM_CHAR_TO_DIGIT(c); break; } LOG_EXITFN(h); }
EXPORT_C MSecModUI* MSecModUI::CreateL() { LOG_CREATE; LOG_ENTERFN("MSecModUI::CreateL()"); LOG_LEAVEFN("MSecModUI::CreateL()"); return CSecModUIModel::NewL(); }
/** * @brief * returns the pointer to imsi ie in GTP message buffer * * @return * returns the pointer to imsi ie in GTP message buffer */ PUBLIC U8* getImsiBufPtr(Buffer *pGtpcBuf) { LOG_ENTERFN(); U8 *pImsi = NULL; GtpIeHdr ieHdr; GtpLength_t len = pGtpcBuf->len; U8 *pBuf = pGtpcBuf->pVal; if (GTP_CHK_T_BIT_PRESENT(pBuf)) { len -= GTP_MSG_HDR_LEN; pBuf += GTP_MSG_HDR_LEN; } else { len -= GTP_MSG_HDR_LEN_WITHOUT_TEID; pBuf += GTP_MSG_HDR_LEN_WITHOUT_TEID; } while (len) { decIeHdr(pBuf, &ieHdr); if (ieHdr.ieType == GTP_IE_IMSI) { pImsi = pBuf; break; } len -= (ieHdr.len + GTP_IE_HDR_LEN); pBuf += (ieHdr.len + GTP_IE_HDR_LEN); } LOG_EXITFN(pImsi); }
PUBLIC RETVAL sendMsg ( TransConnId connId, IPEndPoint *pDst, Buffer *data ) { LOG_ENTERFN(); RETVAL ret = ROK; GSimSocket *pSock = g_gsimSockArr[connId]; if (NULL != pSock) { if (pDst->ipAddr.ipAddrType == IP_ADDR_TYPE_V4) { ret = sendMsgV4(pSock, pDst, data); } else { ret = sendMsgV6(pSock, pDst, data); } } LOG_EXITFN(ret); }
// ----------------------------------------------------------------------------- // CSecModUIModel::ConstructL() // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CSecModUIModel::ConstructL() { LOG_ENTERFN("CSecModUIModel::ConstructL()"); iEikEnv = CEikonEnv::Static(); AddResourceFileL(); #ifndef RD_GS_RENOVATION CSecModUIViewMain* viewMain = CSecModUIViewMain::NewLC(*this); ((CAknViewAppUi*)iEikEnv->EikAppUi())->AddViewL(viewMain); CleanupStack::Pop(viewMain); CSecModUIViewCode* viewCode = CSecModUIViewCode::NewLC(*this); ((CAknViewAppUi*)iEikEnv->EikAppUi())->AddViewL(viewCode); CleanupStack::Pop(viewCode); CSecModUIViewAccess* viewAccess = CSecModUIViewAccess::NewLC(*this); ((CAknViewAppUi*)iEikEnv->EikAppUi())->AddViewL(viewAccess); CleanupStack::Pop(viewAccess); CSecModUIViewSignature* viewSignature = CSecModUIViewSignature::NewLC(*this); ((CAknViewAppUi*)iEikEnv->EikAppUi())->AddViewL(viewSignature); CleanupStack::Pop(viewSignature); #endif InitializeKeyStoreL(); LOG_LEAVEFN("CSecModUIModel::ConstructL()"); }
// --------------------------------------------------------- // CSecModUIViewBase::DoActivateL(...) // // --------------------------------------------------------- // void CSecModUIViewBase::DoActivateL( const TVwsViewId& aPrevViewId,TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) { LOG_ENTERFN("CSecModUIViewBase::DoActivateL()"); if (KNullUid == iPrevViewId.iViewUid) { iPrevViewId = aPrevViewId; } SetTitlePaneL(); AddNaviPaneLabelL(); if (!iContainer) { CreateContainerL(); iContainer->SetMopParent(this); iContainer->ConstructL(ClientRect()); iContainer->ListBox().SetListBoxObserver(this); AppUi()->AddToStackL(*this, iContainer); } iContainer->ListBox().SetTopItemIndex( iTopItem ); //the iCurrentPostion can be -1, if no keystore presents. if ( iCurrentPosition >= 0 ) { iContainer->ListBox().SetCurrentItemIndex( iCurrentPosition ); } iContainer->MakeVisible(ETrue); iContainer->SetRect(ClientRect()); iContainer->ActivateL(); LOG_LEAVEFN("CSecModUIViewBase::DoActivateL()"); }
/** * @brief * Processes the keyboard input from user * * @param */ VOID Keyboard::processKey ( S32 kbInput ) { LOG_ENTERFN(); switch(kbInput) { case 'p': { LOG_DEBUG("Pausing Traffic"); key = KB_KEY_PAUSE_TRAFFIC; break; } case 'c': { LOG_DEBUG("Resuming Traffic"); key = KB_KEY_INVALID; break; } case 'q': { key = KB_KEY_SIM_QUIT; } default: { LOG_DEBUG("Invalid Keyboard Input"); } } LOG_EXITVOID(); }
// --------------------------------------------------------- // CSecModUIContainerBase::SizeChanged() // Called by framework when the view size is changed // --------------------------------------------------------- // void CSecModUIContainerBase::SizeChanged() { LOG_ENTERFN("CSecModUIContainerBase::SizeChanged()"); __ASSERT_ALWAYS(iListBox, Panic(EPanicNullPointer)); iListBox->SetRect(Rect()); LOG_LEAVEFN("CSecModUIContainerBase::SizeChanged()"); }
// ----------------------------------------------------------------------------- // CSecModUIModel::InitializeKeyStoreL() // ----------------------------------------------------------------------------- // TInt CSecModUIModel::InitializeKeyStoreL() { LOG_ENTERFN("CSecModUIModel::InitializeKeyStoreL()"); ResetAndDestroyCTObjects(); iUnifiedKeyStore = CUnifiedKeyStore::NewL(iEikEnv->FsSession()); if (iWrapper == NULL) { iWrapper = CSecModUISyncWrapper::NewL(); } TInt err = iWrapper->Initialize(*iUnifiedKeyStore); ShowErrorNoteL(err); if (KErrNone != err && KErrHardwareNotAvailable != err) { LOG_LEAVEFN("CSecModUIModel::InitializeKeyStoreL()"); return err; } TInt keyStoreCount = iUnifiedKeyStore->KeyStoreCount(); if (0 >= keyStoreCount) { LOG_LEAVEFN("CSecModUIModel::InitializeKeyStoreL()"); return KErrNone; } RMPointerArray<CCTKeyInfo> keyInfos; CleanupClosePushL(keyInfos); TCTKeyAttributeFilter filter; TInt keyInfoCount = 0; filter.iPolicyFilter = TCTKeyAttributeFilter::EAllKeys; for (TInt i = 0; i < keyStoreCount; i++) { err = iWrapper->ListKeys(iUnifiedKeyStore->KeyStore(i), keyInfos, filter); LOG_WRITE_FORMAT( "CSecModUIModel::InitializeKeyStoreL() list err = %d ", err ); //If list ok, append the AO, otherwise go next if ( err == KErrNone ) { keyInfoCount = keyInfos.Count(); for (TInt j = 0; j < keyInfoCount; j++) { // Check that keystore has at least one AO. if (NULL != keyInfos[j]->Protector()) { // If keystore has AO, add it to the array. User::LeaveIfError( iAOKeyStores.Append(&(iUnifiedKeyStore->KeyStore(i)))); break; } } } keyInfos.Close(); } CleanupStack::PopAndDestroy(&keyInfos); //keyInfos LOG_LEAVEFN("CSecModUIModel::InitializeKeyStoreL()"); return KErrNone; }
// ----------------------------------------------------------------------------- // CSecModUIModel::AddResourceFileL() // ----------------------------------------------------------------------------- // void CSecModUIModel::AddResourceFileL() { LOG_ENTERFN("CSecModUIModel::AddResourceFileL()"); // Resource file loading RFs& fs = iEikEnv->FsSession(); TFileName fileName; TParse parse; // secmodui.rsc parse.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, NULL); fileName = parse.FullName(); BaflUtils::NearestLanguageFile( fs, fileName ); iResourceFileOffset = iEikEnv->AddResourceFileL( fileName ); // CertManUI.rsc parse.Set(KResourceFile2, &KDC_RESOURCE_FILES_DIR, NULL); fileName = parse.FullName(); BaflUtils::NearestLanguageFile( fs, fileName ); iResourceFileOffset2 = iEikEnv->AddResourceFileL( fileName ); // CTSecDlg.rsc parse.Set(KResourceFile3, &KDC_RESOURCE_FILES_DIR, NULL); fileName = parse.FullName(); BaflUtils::NearestLanguageFile( fs, fileName ); iResourceFileOffset3 = iEikEnv->AddResourceFileL( fileName ); LOG_LEAVEFN("CSecModUIModel::AddResourceFileL()"); }
PUBLIC VOID procGtpcMsg(UdpData_t *data) { LOG_ENTERFN(); UeSession *ueSsn = NULL; U8 *gtpMsgBuf = NULL; GtpMsgType_t msgType = GTPC_MSG_TYPE_INVALID; gtpMsgBuf = data->buf.pVal; GTP_MSG_GET_TYPE(gtpMsgBuf, msgType); if (GTPC_MSG_CS_REQ == msgType || GTPC_MSG_FR_REQ == msgType) { U8 *imsiBuf = getImsiBufPtr(&data->buf); GtpImsiKey imsiKey; GTP_GET_IE_LEN(imsiBuf, imsiKey.len); MEMCPY(imsiKey.val, imsiBuf + GTP_IE_HDR_LEN, imsiKey.len); ueSsn = UeSession::getUeSession(imsiKey); if (NULL == ueSsn) { addPeerData(data->peerEp); ueSsn = UeSession::createUeSession(imsiKey); } } else { GtpTeid_t teid = 0; GTP_MSG_DEC_TEID(gtpMsgBuf, teid); if (0 != teid) { ueSsn = UeSession::getUeSession(teid); if (NULL == ueSsn) { LOG_ERROR("GTPC Message received with unknown TEID [%d]", teid); delete data; } else { ueSsn->resumeTask(); } } else { LOG_ERROR("Unhandled Incoming GTP Message"); delete data; } } if (NULL != ueSsn) { if (ROK != ueSsn->run(data)) { ueSsn->abort(); } } LOG_EXITVOID(); }
VOID Keyboard::abort() { LOG_ENTERFN(); delete this; LOG_EXITVOID(); }
// --------------------------------------------------------- // CSecModUIViewBase::HandleClientRectChange() // --------------------------------------------------------- // void CSecModUIViewBase::HandleClientRectChange() { LOG_ENTERFN("CSecModUIViewBase::HandleClientRectChange()"); if ( iContainer ) { iContainer->SetRect( ClientRect() ); } LOG_LEAVEFN("CSecModUIViewBase::HandleClientRectChange()"); }
/** * @brief * allocates a new imsi incremented by one * * @return * imsi */ VOID GtpImsiGenerator::allocNew(GtpImsiKey *pImsi) { LOG_ENTERFN(); numericStrIncriment(m_imsiStr, m_len); pImsi->len = encodeImsi(m_imsiStr, m_len, pImsi->val); LOG_EXITVOID(); }
BOOL Display::run() { LOG_ENTERFN(); m_lastRunTime = getMilliSeconds(); disp(); pauseTask(); LOG_EXITFN(TRUE); }
VOID decIeHdr(U8 *pBuf, GtpIeHdr *pHdr) { LOG_ENTERFN(); MEMSET((VOID *)pHdr, 0, sizeof(GtpIeHdr)); GTP_DEC_IE_TYPE(pBuf, pHdr->ieType); GTP_DEC_IE_LEN(pBuf, pHdr->len); GTP_DEC_IE_INSTANCE(pBuf, pHdr->instance); LOG_EXITVOID(); }
// ----------------------------------------------------------------------------- // CSecModUIModel::NewL() // Two-phased constructor. // ----------------------------------------------------------------------------- // CSecModUIModel* CSecModUIModel::NewL() { LOG_ENTERFN("CSecModUIModel::NewL()"); CSecModUIModel* self = new( ELeave ) CSecModUIModel(); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); LOG_LEAVEFN("CSecModUIModel::NewL()"); return self; }
// --------------------------------------------------------- // CSecModUIContainerBase::OfferKeyEventL( // const TKeyEvent& aKeyEvent,TEventCode aType) // --------------------------------------------------------- // TKeyResponse CSecModUIContainerBase::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) { if (iModel.Wrapper().IsActive()) { // Do not start new operation, if previous is still ongoing. return EKeyWasConsumed; } LOG_ENTERFN("CSecModUIContainerBase::OfferKeyEventL()"); LOG_LEAVEFN("CSecModUIContainerBase::OfferKeyEventL()"); return iListBox->OfferKeyEventL(aKeyEvent, aType); }
PUBLIC U32 gtpConvStrToU32(const S8 *pVal, U32 len) { LOG_ENTERFN(); S8 *tmp = NULL; S8 buf[GSIM_SIZE_32] = {'\0'}; MEMCPY(buf, pVal, len); U32 v = strtoul(buf, &tmp, 10); LOG_EXITFN(v); }
// --------------------------------------------------------- // CSecModUIContainerBase::ComponentControl(TInt aIndex) const // --------------------------------------------------------- // CCoeControl* CSecModUIContainerBase::ComponentControl(TInt aIndex) const { LOG_ENTERFN("CSecModUIContainerBase::ComponentControl()"); LOG_LEAVEFN("CSecModUIContainerBase::ComponentControl()"); switch ( aIndex ) { case 0: return iListBox; default: return NULL; } }
/** * @brief * Hanldes GTP-U socket, reads GTP-U Process control messages * * @param pSock * * @return */ PRIVATE RETVAL handleGtpuSock ( GSimSocket *pSock ) { LOG_ENTERFN(); RETVAL ret = ROK; LOG_EXITFN(ret); }
GtpMsgCategory_t gtpGetMsgCategory(GtpMsgType_t msgType) { LOG_ENTERFN(); GtpMsgCategory_t msgCat = GTP_MSG_CAT_INV; if (msgType <= GTPC_MSG_TYPE_MAX) { msgCat = g_gtpMsgCat[msgType]; } LOG_EXITFN(msgCat); }
// ----------------------------------------------------------------------------- // CSecModUIModel::ResetAndDestroyCTObjects() // ----------------------------------------------------------------------------- // void CSecModUIModel::ResetAndDestroyCTObjects() { LOG_ENTERFN("CSecModUIModel::ResetAndDestroyCTObjects()"); ResetAndDestroyAOs(); iAOKeyStores.Reset(); delete iUnifiedKeyStore; iUnifiedKeyStore = NULL; iKeyStore = NULL; LOG_LEAVEFN("CSecModUIModel::ResetAndDestroyCTObjects()"); }
/** * @brief * Creates Keyboard socket */ VOID Keyboard::init() { LOG_ENTERFN(); LOG_DEBUG("Setting up STDIN Socket for keyboard"); if (ROK != setupStdinSock()) { LOG_FATAL("Setting up STDIN Socket for keyboard"); throw ERR_KEYBOARD_INIT; } LOG_EXITFN(); }
GtpIfType_t gtpConvStrToIfType(const S8 *pVal, U32 len) { LOG_ENTERFN(); GtpIfType_t ifType = (GtpIfType_t)gtpConvStrToU32(pVal, len); if (ifType >= GTP_IF_INF_INV) { ifType = GTP_IF_INF_INV; LOG_ERROR("Unrecognized Interface type string [%s]", pVal); } LOG_EXITFN(ifType); }
PUBLIC VOID deleteCTun(GtpcTun *pTun) { LOG_ENTERFN(); pTun->m_refCount--; if (pTun->m_refCount == 0) { LOG_DEBUG("Deleting GTP-C Tunnel, TEID [%d]", pTun->m_locTeid); s_gtpcTunMap.erase(pTun->m_locTeid); delete pTun; } LOG_EXITVOID(); }
// --------------------------------------------------------- // CSecModUIContainerBase::HandleListBoxEventL( // CEikListBox* aListBox, TListBoxEvent aEventType) // --------------------------------------------------------- // void CSecModUIViewBase::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType) { LOG_ENTERFN("CSecModUIContainerBase::HandleListBoxEventL()"); switch( aEventType ) { default: { break; } } LOG_LEAVEFN("CSecModUIContainerBase::HandleListBoxEventL()"); }
// --------------------------------------------------------- // CSecModUIViewBase::DoDeactivate() // // --------------------------------------------------------- // void CSecModUIViewBase::DoDeactivate() { LOG_ENTERFN("CSecModUIViewBase::DoDeactivate()"); if ( iContainer ) { AppUi()->RemoveFromViewStack( *this, iContainer ); iCurrentPosition = iContainer->ListBox().CurrentItemIndex(); iTopItem = iContainer->ListBox().TopItemIndex(); } delete iContainer; iContainer = NULL; LOG_LEAVEFN("CSecModUIViewBase::DoDeactivate()"); }