📄 ospmsginfo.c
字号:
/**########################################################################*########################################################################*########################################################################* * COPYRIGHT (c) 1998, 1999 by TransNexus, LLC * * This software contains proprietary and confidential information * of TransNexus, LLC. Except as may be set forth in the license * agreement under which this software is supplied, use, disclosure, * or reproduction is prohibited without the prior, express, written* consent of TransNexus, LLC. * *******#########################################################################*#########################################################################*#########################################################################*//* * ospmsginfo.c */#include "osp.h"#include "ospmsginfo.h"staticintosppMsgInfoInitSync( OSPTMSGINFO *ospvMsgInfo){ int errorcode = OSPC_ERR_NO_ERROR, tmperror = OSPC_ERR_NO_ERROR; OSPM_DBGENTER(("ENTER: osppMsgInfoInitSync()\n")); OSPM_MUTEX_INIT(ospvMsgInfo->Mutex, NULL, errorcode); if (errorcode == OSPC_ERR_NO_ERROR) { OSPM_CONDVAR_INIT(ospvMsgInfo->CondVar, NULL, errorcode); if (errorcode != OSPC_ERR_NO_ERROR) { OSPM_MUTEX_DESTROY(ospvMsgInfo->Mutex, tmperror); } } OSPM_DBGEXIT(("EXIT : osppMsgInfoInitSync()\n")); return errorcode;}intOSPPMsgInfoNew( OSPTMSGINFO **ospvMsgInfo){ int errorcode = OSPC_ERR_NO_ERROR; OSPM_DBGENTER(("ENTER: OSPPMsgInfoNew()\n")); OSPM_MALLOC(*ospvMsgInfo, OSPTMSGINFO, sizeof(OSPTMSGINFO)); if (*ospvMsgInfo != (OSPTMSGINFO *)OSPC_OSNULL) { OSPM_MEMSET(*ospvMsgInfo, 0, sizeof(OSPTMSGINFO)); errorcode = osppMsgInfoInitSync(*ospvMsgInfo); if (errorcode != OSPC_ERR_NO_ERROR) { OSPM_FREE(*ospvMsgInfo); *ospvMsgInfo = (OSPTMSGINFO *)OSPC_OSNULL; } } OSPM_DBGEXIT(("EXIT : OSPPMsgInfoNew()\n")); return errorcode;}voidOSPPMsgInfoDelete( OSPTMSGINFO **ospvMsgInfo){ int errorcode = OSPC_ERR_NO_ERROR; OSPM_DBGENTER(("ENTER: OSPPMsgInfoDelete()\n")); if (*ospvMsgInfo) { if ((*ospvMsgInfo)->ResponseMsg != (unsigned char *)OSPC_OSNULL) OSPM_FREE((*ospvMsgInfo)->ResponseMsg); if ((*ospvMsgInfo)->RequestMsg != (unsigned char *)OSPC_OSNULL) OSPM_FREE((*ospvMsgInfo)->RequestMsg); if ((*ospvMsgInfo)->ContentType != (unsigned char *)OSPC_OSNULL) OSPM_FREE((*ospvMsgInfo)->ContentType); OSPM_MUTEX_DESTROY((*ospvMsgInfo)->Mutex, errorcode); OSPM_CONDVAR_DESTROY((*ospvMsgInfo)->CondVar, errorcode); OSPM_FREE(*ospvMsgInfo); *ospvMsgInfo = (OSPTMSGINFO *)OSPC_OSNULL; } OSPM_DBGEXIT(("EXIT : OSPPMsgInfoDelete()\n")); return;}voidOSPPMsgInfoAssignRequestMsg( OSPTMSGINFO *ospvMsgInfo, unsigned char *ospvRequestMsg, unsigned ospvRequestSz){ OSPM_DBGENTER(("ENTER: OSPPMsgInfoAssignRequestMsg()\n")); if (ospvMsgInfo != (OSPTMSGINFO *)OSPC_OSNULL) { ospvMsgInfo->RequestMsg = ospvRequestMsg; ospvMsgInfo->RequestSz = ospvRequestSz; } OSPM_DBGEXIT(("EXIT : OSPPMsgInfoAssignRequestMsg()\n")); return;}intOSPPMsgInfoProcessResponse( OSPTMSGINFO *ospvMsgInfo){ int errorcode = OSPC_ERR_NO_ERROR, tmperrcode = OSPC_ERR_NO_ERROR; OSPM_DBGENTER(("ENTER: OSPPMsgInfoProcessResponse()\n")); /* * once signalled, acquire the mutex for the individual * transaction. */ OSPM_MUTEX_LOCK(ospvMsgInfo->Mutex, errorcode); if (errorcode == OSPC_ERR_NO_ERROR) { OSPM_CONDVAR_SIGNAL(ospvMsgInfo->CondVar, errorcode); OSPM_MUTEX_UNLOCK(ospvMsgInfo->Mutex, tmperrcode); } OSPM_DBGEXIT(("EXIT : OSPPMsgInfoProcessResponse()\n")); return errorcode;}intOSPPMsgInfoWaitForMsg( OSPTMSGINFO *ospvMsgInfo){ int errorcode = OSPC_ERR_NO_ERROR; OSPM_DBGENTER(("ENTER: OSPPMsgInfoWaitForMsg()\n")); OSPM_MUTEX_LOCK(ospvMsgInfo->Mutex, errorcode); if (errorcode == OSPC_ERR_NO_ERROR) { while (ospvMsgInfo->ResponseMsg == OSPC_OSNULL && ospvMsgInfo->ErrorCode == OSPC_ERR_NO_ERROR) { OSPM_CONDVAR_WAIT(ospvMsgInfo->CondVar, ospvMsgInfo->Mutex, errorcode); } OSPM_MUTEX_UNLOCK(ospvMsgInfo->Mutex, errorcode); } OSPM_DBGEXIT(("EXIT : OSPPMsgInfoWaitForMsg()\n")); return errorcode;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -