static int RetrieveTupLen4PageSize( void ) { int iret, SessType, ilocsession,dwRange; char connectname[MAXOBJECTNAME]; char szValue[40]; char szConst[MAX_ENUMTUPLEN][14] = {"tup_len_2k", "tup_len_4k", "tup_len_8k", "tup_len_16k", "tup_len_32k", "tup_len_64k" }; if (GetOIVers() >= OIVERS_30) { SessType=SESSION_TYPE_CACHENOREADLOCK; wsprintf(connectname,"%s::iidbdb",GetVirtNodeName(GetCurMdiNodeHandle ())); iret = Getsession(connectname, SessType, &ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; for (dwRange=0;dwRange<MAX_ENUMTUPLEN;dwRange++) { INGRESII_llDBMSInfo(szConst[dwRange],szValue); if (szValue[0] != '0') iTabRowsSpanPages[dwRange] = my_atoi(szValue); } if (iret==RES_SUCCESS) iret=ReleaseSession(ilocsession, RELEASE_COMMIT); else ReleaseSession(ilocsession, RELEASE_ROLLBACK); } return RES_SUCCESS; }
// パケットアダプタの解放 void LinkPaFree(SESSION *s) { LINK *k; // 引数チェック if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) { return; } // サーバーセッションの停止 StopSession(k->ServerSession); ReleaseSession(k->ServerSession); // 送信パケットキューの解放 LockQueue(k->SendPacketQueue); { BLOCK *block; while (block = GetNext(k->SendPacketQueue)) { FreeBlock(block); } } UnlockQueue(k->SendPacketQueue); ReleaseQueue(k->SendPacketQueue); }
// Release the packet adapter void LinkPaFree(SESSION *s) { LINK *k; // Validate arguments if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) { return; } // Stop the server session StopSession(k->ServerSession); ReleaseSession(k->ServerSession); // Release the transmission packet queue LockQueue(k->SendPacketQueue); { BLOCK *block; while (block = GetNext(k->SendPacketQueue)) { FreeBlock(block); } } UnlockQueue(k->SendPacketQueue); ReleaseQueue(k->SendPacketQueue); }
// Release the packet adapter void LinkPaFree(SESSION *s) { LINK *k; // Validate arguments if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) { return; } CedarAddQueueBudget(k->Cedar, -((int)k->LastServerConnectionReceivedBlocksNum)); k->LastServerConnectionReceivedBlocksNum = 0; // Stop the server session StopSession(k->ServerSession); ReleaseSession(k->ServerSession); // Release the transmission packet queue LockQueue(k->SendPacketQueue); { BLOCK *block; while (block = GetNext(k->SendPacketQueue)) { FreeBlock(block); } } UnlockQueue(k->SendPacketQueue); ReleaseQueue(k->SendPacketQueue); k->CurrentSendPacketQueueSize = 0; }
// Delete the UDP session from the UDP entry void DelUDPEntry(CEDAR *cedar, SESSION *session) { UINT num, i; // Validate arguments if (cedar == NULL || session == NULL) { return; } LockList(cedar->UDPEntryList); { num = LIST_NUM(cedar->UDPEntryList); for (i = 0;i < num;i++) { UDP_ENTRY *e = LIST_DATA(cedar->UDPEntryList, i); if (e->Session == session) { ReleaseSession(e->Session); Delete(cedar->UDPEntryList, e); Free(e); UnlockList(cedar->UDPEntryList); Debug("UDP_Entry Deleted.\n"); return; } } } UnlockList(cedar->UDPEntryList); }
// An UDP packet has been received void UDPReceivedPacket(CEDAR *cedar, SOCK *s, IP *ip, UINT port, void *data, UINT size) { SESSION *session; UINT *key32; UCHAR *buf; CONNECTION *c; // Validate arguments if (s == NULL || ip == NULL || data == NULL || size == 0 || cedar == NULL) { return; } if (size < 16) { // Ignore since the packet size is not enough return; } buf = (UCHAR *)data; key32 = (UINT *)(buf + 4); // Get the session from the Key32 value session = GetSessionFromUDPEntry(cedar, Endian32(*key32)); if (session == NULL) { Debug("Invalid UDP Session Key 32: 0x%X\n", *key32); return; } c = session->Connection; // Write the data PutUDPPacketData(c, buf, size); // Rewrite the UDP socket associated with the connection Lock(c->lock); { if (c->Protocol == CONNECTION_UDP) { if (c->Udp->s != s) { if (c->Udp->s != NULL) { ReleaseSock(c->Udp->s); } AddRef(s->ref); c->Udp->s = s; } Copy(&c->Udp->ip, ip, sizeof(UINT)); c->Udp->port = port; } } Unlock(c->lock); // Invoke the Cancel Cancel(session->Cancel1); // Release the session ReleaseSession(session); }
int VDBAGetCommentInfo ( LPTSTR lpNodeName,LPTSTR lpDBName, LPTSTR lpObjName, LPTSTR lpObjOwner,LPTSTR *lpObjComment, LPOBJECTLIST lpObjColumn) { int ires, hdl; TCHAR tchszConnection [MAXOBJECTNAME*2]; wsprintf (tchszConnection,"%s::%s", lpNodeName, lpDBName); ires = Getsession (tchszConnection, SESSION_TYPE_CACHENOREADLOCK, &hdl); if (ires != RES_SUCCESS) return RES_ERR; ires = SQLGetComment( lpNodeName, lpDBName, lpObjName, lpObjOwner, lpObjComment, lpObjColumn); if (ires==RES_SUCCESS) ires=ReleaseSession(hdl, RELEASE_COMMIT); else ReleaseSession(hdl, RELEASE_ROLLBACK); return ires; }
BOOL VDBA20xGetDetailUKeyInfo (LPTABLEPARAMS lpTS, LPTSTR lpVnode) { int ires, hdl; TCHAR tchszConnection [100]; wsprintf (tchszConnection,"%s::%s", lpVnode, lpTS->DBName); ires = Getsession (tchszConnection, SESSION_TYPE_CACHENOREADLOCK, &hdl); if (ires != RES_SUCCESS) { ires = ReleaseSession(hdl, RELEASE_COMMIT); return FALSE; } lpTS->lpUnique = VDBA20xTableUniqueKey_Done (lpTS->lpUnique); ires = VDBA2xGetTableUniqueKeyInfo (lpTS); if (ires != RES_SUCCESS) { ires = ReleaseSession(hdl, RELEASE_COMMIT); return FALSE; } ires = ReleaseSession(hdl, RELEASE_COMMIT); return TRUE; }
// Bridging thread void BrBridgeThread(THREAD *thread, void *param) { BRIDGE *b; CONNECTION *c; SESSION *s; HUB *h; char name[MAX_SIZE]; // Validate arguments if (thread == NULL || param == NULL) { return; } b = (BRIDGE *)param; // Create a connection object c = NewServerConnection(b->Cedar, NULL, thread); c->Protocol = CONNECTION_HUB_BRIDGE; // Create a session object s = NewServerSession(b->Cedar, c, b->Hub, BRIDGE_USER_NAME, b->Policy); HLog(b->Hub, "LH_START_BRIDGE", b->Name, s->Name); StrCpy(name, sizeof(name), b->Name); h = b->Hub; AddRef(h->ref); s->BridgeMode = true; s->Bridge = b; c->Session = s; ReleaseConnection(c); // Dummy user name for local-bridge s->Username = CopyStr(BRIDGE_USER_NAME_PRINT); b->Session = s; AddRef(s->ref); // Notify completion NoticeThreadInit(thread); // Main procedure of the session Debug("Bridge %s Start.\n", b->Name); SessionMain(s); Debug("Bridge %s Stop.\n", b->Name); HLog(h, "LH_STOP_BRIDGE", name); ReleaseHub(h); ReleaseSession(s); }
// リンクサーバースレッド void LinkServerSessionThread(THREAD *t, void *param) { LINK *k = (LINK *)param; CONNECTION *c; SESSION *s; POLICY *policy; wchar_t name[MAX_SIZE]; // 引数チェック if (t == NULL || param == NULL) { return; } // サーバーコネクションの作成 c = NewServerConnection(k->Cedar, NULL, t); c->Protocol = CONNECTION_HUB_LINK_SERVER; // ポリシーの作成 policy = ZeroMalloc(sizeof(POLICY)); Copy(policy, k->Policy, sizeof(POLICY)); // サーバーセッションの作成 s = NewServerSession(k->Cedar, c, k->Hub, LINK_USER_NAME, policy); s->LinkModeServer = true; s->Link = k; c->Session = s; ReleaseConnection(c); // ユーザー名 s->Username = CopyStr(LINK_USER_NAME_PRINT); k->ServerSession = s; AddRef(k->ServerSession->ref); // 初期化完了を通知 NoticeThreadInit(t); UniStrCpy(name, sizeof(name), k->Option->AccountName); HLog(s->Hub, "LH_LINK_START", name, s->Name); // セッションのメイン関数 SessionMain(s); HLog(s->Hub, "LH_LINK_STOP", name); ReleaseSession(s); }
// Link server thread void LinkServerSessionThread(THREAD *t, void *param) { LINK *k = (LINK *)param; CONNECTION *c; SESSION *s; POLICY *policy; wchar_t name[MAX_SIZE]; // Validate arguments if (t == NULL || param == NULL) { return; } // Create a server connection c = NewServerConnection(k->Cedar, NULL, t); c->Protocol = CONNECTION_HUB_LINK_SERVER; // Create a policy policy = ZeroMalloc(sizeof(POLICY)); Copy(policy, k->Policy, sizeof(POLICY)); // Create a server session s = NewServerSession(k->Cedar, c, k->Hub, LINK_USER_NAME, policy); s->LinkModeServer = true; s->Link = k; c->Session = s; ReleaseConnection(c); // User name s->Username = CopyStr(LINK_USER_NAME_PRINT); k->ServerSession = s; AddRef(k->ServerSession->ref); // Notify the initialization completion NoticeThreadInit(t); UniStrCpy(name, sizeof(name), k->Option->AccountName); HLog(s->Hub, "LH_LINK_START", name, s->Name); // Main function of session SessionMain(s); HLog(s->Hub, "LH_LINK_STOP", name); ReleaseSession(s); }
BOOL CxDlgObjectComment::FillListColumnWithComment( void ) { // // Get Session int hdl, nRes = RES_ERR ; TCHAR tcDBName [MAXOBJECTNAME]; TCHAR tcObjectName [MAXOBJECTNAME]; TCHAR tcObjectOwner [MAXOBJECTNAME]; CString strSess; m_tcObjComment = NULL; CString strVNodeName = (LPTSTR)GetVirtNodeName(m_nNodeHandle); x_strcpy(tcDBName,m_csDBName); x_strcpy(tcObjectName, m_csObjectName ); x_strcpy(tcObjectOwner,m_csObjectOwner); strSess.Format (_T("%s::%s"), (LPTSTR)(LPCTSTR)strVNodeName, (LPTSTR)(LPCTSTR)m_csDBName); nRes = Getsession ((LPUCHAR)(LPCTSTR)strSess, SESSION_TYPE_CACHEREADLOCK, &hdl); if (nRes != RES_SUCCESS) { TRACE0 (_T("CxDlgObjectComment::FillListColumnWithComment(): Fail to Get the session\n")); return FALSE; } nRes = SQLGetComment( (LPTSTR)(LPCTSTR)strVNodeName, tcDBName, tcObjectName, tcObjectOwner, &m_tcObjComment, m_ListColumn); ReleaseSession (hdl, RELEASE_COMMIT); if (nRes != RES_SUCCESS) { CString csMsg; csMsg.LoadString(IDS_E_COMMENTS_FAILED); MessageWithHistoryButton(m_hWnd,csMsg); return FALSE; } if (m_tcObjComment) SetCommentObject(m_tcObjComment); return TRUE; }
// Free the local-bridge object void BrFreeBridge(BRIDGE *b) { // Validate arguments if (b == NULL) { return; } if (b->ParentLocalBridge != NULL) { b->ParentLocalBridge = NULL; } // Stop session thread StopSession(b->Session); ReleaseSession(b->Session); Free(b); }
// Stop the link void StopLink(LINK *k) { // Validate arguments if (k == NULL) { return; } LockLink(k); { if (k->Started == false) { UnlockLink(k); return; } k->Started = false; k->Halting = true; Dec(k->Cedar->CurrentActiveLinks); } UnlockLink(k); if (k->ClientSession != NULL) { // Disconnect the client session StopSession(k->ClientSession); LockLink(k); { ReleaseSession(k->ClientSession); k->ClientSession = NULL; } UnlockLink(k); } LockLink(k); { k->Halting = false; } UnlockLink(k); }
// Release all Layer-3 interfaces void L3FreeAllInterfaces(L3SW *s) { UINT i; // Validate arguments if (s == NULL) { return; } for (i = 0;i < LIST_NUM(s->IfList);i++) { L3IF *f = LIST_DATA(s->IfList, i); ReleaseHub(f->Hub); f->Hub = NULL; ReleaseSession(f->Session); f->Session = NULL; L3FreeInterface(f); } }
// リンクの停止 void StopLink(LINK *k) { // 引数チェック if (k == NULL) { return; } LockLink(k); { if (k->Started == false) { UnlockLink(k); return; } k->Started = false; k->Halting = true; } UnlockLink(k); if (k->ClientSession != NULL) { // クライアントセッション切断 StopSession(k->ClientSession); LockLink(k); { ReleaseSession(k->ClientSession); k->ClientSession = NULL; } UnlockLink(k); } LockLink(k); { k->Halting = false; } UnlockLink(k); }
// Release the SecureNAT void SnFreeSecureNAT(SNAT *s) { // Validate arguments if (s == NULL) { return; } // Stop the session StopSession(s->Session); ReleaseSession(s->Session); // Virtual machine release Virtual_Free(s->Nat->Virtual); // NAT release NiFreeNat(s->Nat); DeleteLock(s->lock); Free(s); }
// Clean-up the link void CleanupLink(LINK *k) { // Validate arguments if (k == NULL) { return; } DeleteLock(k->lock); if (k->ClientSession) { ReleaseSession(k->ClientSession); } Free(k->Option); CiFreeClientAuth(k->Auth); Free(k->Policy); if (k->ServerCert != NULL) { FreeX(k->ServerCert); } Free(k); }
// Layer-3 interface thread void L3IfThread(THREAD *t, void *param) { L3IF *f; CONNECTION *c; SESSION *s; POLICY *policy; char tmp[MAX_SIZE]; char name[MAX_SIZE]; char username[MAX_SIZE]; // Validate arguments if (t == NULL || param == NULL) { return; } f = (L3IF *)param; StrCpy(username, sizeof(username), L3_USERNAME); if (f->Switch != NULL) { StrCat(username, sizeof(username), f->Switch->Name); } // Create a connection c = NewServerConnection(f->Switch->Cedar, NULL, t); c->Protocol = CONNECTION_HUB_LAYER3; // Create a Session policy = ClonePolicy(GetDefaultPolicy()); // Not to limit the number of broadcast by policy policy->NoBroadcastLimiter = true; s = NewServerSession(f->Switch->Cedar, c, f->Hub, username, policy); c->Session = s; ReleaseConnection(c); // Determine the name of the session GetMachineHostName(tmp, sizeof(tmp)); if (f->Switch->Cedar->Server->ServerType == SERVER_TYPE_STANDALONE) { Format(name, sizeof(name), "SID-L3-%s-%u", f->Switch->Name, Inc(f->Hub->SessionCounter)); } else { Format(name, sizeof(name), "SID-L3-%s-%s-%u", tmp, f->Switch->Name, Inc(f->Hub->SessionCounter)); } ConvertSafeFileName(name, sizeof(name), name); StrUpper(name); Free(s->Name); s->Name = CopyStr(name); s->L3SwitchMode = true; s->L3If = f; if (s->Username != NULL) { Free(s->Username); } s->Username = CopyStr(username); StrCpy(s->UserNameReal, sizeof(s->UserNameReal), username); f->Session = s; AddRef(s->ref); // Notify the initialization completion NoticeThreadInit(t); // Session main process SessionMain(s); // Release the session ReleaseSession(s); }
int GetDetailInfoLL(LPUCHAR lpVirtNode,int iobjecttype, void *lpparameters, BOOL bRetainSessForLock, int *ilocsession) { int iret, SessType; char connectname[MAXOBJECTNAME]; if (!lpparameters) { myerror(ERR_INVPARAMS); return RES_ERR; } if (bRetainSessForLock) SessType=SESSION_TYPE_CACHEREADLOCK; else SessType=SESSION_TYPE_CACHENOREADLOCK; switch (iobjecttype) { case OT_SEQUENCE: { LPSEQUENCEPARAMS pseqprm=(LPSEQUENCEPARAMS) lpparameters; if (!*(pseqprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pseqprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pseqprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfSequence(pseqprm); } break; case OT_REPLIC_CONNECTION_V11: { LPREPLCONNECTPARAMS lpaddrepl= (LPREPLCONNECTPARAMS)lpparameters; ; wsprintf(connectname,"%s::%s",lpVirtNode,lpaddrepl->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret = ReplicConnectV11(lpaddrepl); } break; case OT_REPLIC_CONNECTION: { LPREPLCONNECTPARAMS lpaddrepl= (LPREPLCONNECTPARAMS)lpparameters; ; wsprintf(connectname,"%s::%s",lpVirtNode,lpaddrepl->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret = ReplicConnect(lpaddrepl); } break; case OT_DBEVENT: iret =RES_SUCCESS; // no displayable property // TO BE FINISHED session not opened. break; case OT_ROLE: { LPROLEPARAMS proleprm=(LPROLEPARAMS) lpparameters; if (!*(proleprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfRole(proleprm); } break; //JFS Begin case OT_REPLIC_CDDS : case OT_REPLIC_CDDS_V11 : { LPREPCDDS lpcdds = (LPREPCDDS)lpparameters; wsprintf(connectname,"%s::%s",lpVirtNode,lpcdds->DBName); iret = Getsession(connectname, SESSION_TYPE_INDEPENDENT, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret = CDDSLoadAll(lpcdds,lpVirtNode); } break; //JFS End case OT_GROUP : { LPGROUPPARAMS pgrpprm=(LPGROUPPARAMS) lpparameters; if (!*(pgrpprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfGrp(pgrpprm); } break; case OT_INTEGRITY: { LPINTEGRITYPARAMS pintegrityprm=(LPINTEGRITYPARAMS) lpparameters; if (!*(pintegrityprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pintegrityprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfIntegrity(pintegrityprm); } break; case OT_LOCATION: { LPLOCATIONPARAMS plocprm=(LPLOCATIONPARAMS) lpparameters; if (!*(plocprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfLoc(plocprm); } break; case OT_PROCEDURE: { LPPROCEDUREPARAMS pprocprm=(LPPROCEDUREPARAMS) lpparameters; if (!*(pprocprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pprocprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pprocprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfProcedure(pprocprm); } break; case OT_RULE: { LPRULEPARAMS pruleprm=(LPRULEPARAMS) lpparameters; if (!*(pruleprm->RuleName)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pruleprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pruleprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfRule(pruleprm); } break; case OT_USER : { LPUSERPARAMS pusrprm=(LPUSERPARAMS) lpparameters; if (!*(pusrprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfUsr(pusrprm); } break; case OT_PROFILE : { LPPROFILEPARAMS pprofprm=(LPPROFILEPARAMS) lpparameters; if (!*(pprofprm->ObjectName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfProf(pprofprm); } break; case OT_VIEW: { LPVIEWPARAMS pviewprm=(LPVIEWPARAMS) lpparameters; if (!*(pviewprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pviewprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } wsprintf(connectname,"%s::%s",lpVirtNode, pviewprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfView(pviewprm); } break; case OT_INDEX: { LPINDEXPARAMS pindexprm=(LPINDEXPARAMS) lpparameters; if (!*(pindexprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(pindexprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::%s",lpVirtNode, pindexprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; x_strcpy(pindexprm->szNodeName, lpVirtNode); iret=GetInfIndex(pindexprm); } break; case OT_TABLE: { LPTABLEPARAMS ptableprm=(LPTABLEPARAMS) lpparameters; if (!*(ptableprm->objectname)) { myerror(ERR_INVPARAMS); return RES_ERR; } if (!*(ptableprm->DBName)) { myerror(ERR_INVPARAMS); return RES_ERR; } FreeAttachedPointers(lpparameters, iobjecttype); wsprintf(connectname,"%s::%s",lpVirtNode, ptableprm->DBName); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; x_strcpy(ptableprm->szNodeName, lpVirtNode); iret=GetInfTable(ptableprm); } break; case OT_DATABASE: { LPDATABASEPARAMS pbaseprm=(LPDATABASEPARAMS) lpparameters; wsprintf(connectname,"%s::%s",lpVirtNode,pbaseprm->objectname); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfBaseExtend(pbaseprm); // retrieve UNICODE information pbaseprm->bUnicodeDBNFD = 0; pbaseprm->bUnicodeDBNFC = 0; if (iret==RES_SUCCESS && GetOIVers() >= OIVERS_26) { TCHAR tcVersion[40]; TCHAR tcNormalization[40]; INGRESII_llDBMSInfo(_T("unicode_level"),tcVersion); INGRESII_llDBMSInfo(_T("unicode_normalization"), tcNormalization); if (tcVersion[0] != '0' && (x_strcmp(tcNormalization, "NFD")==0)) pbaseprm->bUnicodeDBNFD = 1; if (tcVersion[0]!='0' && (x_strcmp(tcNormalization, "NFC")==0)) pbaseprm->bUnicodeDBNFC = 1; } // Retrieve the current Catalog Page Size if (iret==RES_SUCCESS && GetOIVers() >= OIVERS_30) iret = GetCatalogPageSize(pbaseprm); if (iret==RES_SUCCESS) iret=ReleaseSession(*ilocsession, RELEASE_COMMIT); else ReleaseSession(*ilocsession, RELEASE_ROLLBACK); wsprintf(connectname,"%s::iidbdb",lpVirtNode); iret = Getsession(connectname, SessType, ilocsession); if (iret !=RES_SUCCESS) return RES_ERR; iret=GetInfBase(pbaseprm); } break; default : iret=RES_ERR; } if (bRetainSessForLock) // The session was asked to be retained for... return iret; // ... locking purposes, return without releasing. if (iret==RES_SUCCESS) iret=ReleaseSession(*ilocsession, RELEASE_COMMIT); else ReleaseSession(*ilocsession, RELEASE_ROLLBACK); return iret; }
// SecureNAT server-side thread void SnSecureNATThread(THREAD *t, void *param) { SNAT *s; CONNECTION *c; SESSION *se; POLICY *policy; HUB *h; // Validate arguments if (t == NULL || param == NULL) { return; } s = (SNAT *)param; // Create a server connection c = NewServerConnection(s->Cedar, NULL, t); c->Protocol = CONNECTION_HUB_SECURE_NAT; // Apply the default policy policy = ClonePolicy(GetDefaultPolicy()); // Not to limit the number of broadcast policy->NoBroadcastLimiter = true; h = s->Hub; AddRef(h->ref); // create a server session se = NewServerSession(s->Cedar, c, s->Hub, SNAT_USER_NAME, policy); se->SecureNATMode = true; se->SecureNAT = s; c->Session = se; ReleaseConnection(c); HLog(se->Hub, "LH_NAT_START", se->Name); // User name se->Username = CopyStr(SNAT_USER_NAME_PRINT); s->Session = se; AddRef(se->ref); // Notification initialization completion NoticeThreadInit(t); ReleaseCancel(s->Nat->Virtual->Cancel); s->Nat->Virtual->Cancel = se->Cancel1; AddRef(se->Cancel1->ref); if (s->Nat->Virtual->NativeNat != NULL) { CANCEL *old_cancel = NULL; Lock(s->Nat->Virtual->NativeNat->CancelLock); { if (s->Nat->Virtual->NativeNat->Cancel != NULL) { old_cancel = s->Nat->Virtual->NativeNat->Cancel; s->Nat->Virtual->NativeNat->Cancel = se->Cancel1; AddRef(se->Cancel1->ref); } } Unlock(s->Nat->Virtual->NativeNat->CancelLock); if (old_cancel != NULL) { ReleaseCancel(old_cancel); } } // Main function of the session Debug("SecureNAT Start.\n"); SessionMain(se); Debug("SecureNAT Stop.\n"); HLog(se->Hub, "LH_NAT_STOP"); ReleaseHub(h); ReleaseSession(se); }