コード例 #1
0
void
BUILD_SYSTEM_MSG_CALL(
	   const CEE_handle_def *call_id_ 
	,  void *request_ 
	,  int countRead
	,  FS_Receiveinfo_Type* receiveInfo
)
{
	CEE_status sts = CEE_SUCCESS;
	CEE_tag_def objtag_ = 0;
	CEERCV_SystemMessage_exc_ exception_;
	IDL_short error = 0;
	CEERCV_SystemMessage_reply_seq_ reply;
	CEERCV_SystemMessage_request_seq_ request;
	request._buffer = (IDL_short *)request_;
	request._length = countRead;

	CEERCV_SystemMessage_sme_(
		  NULL
		, call_id_
		, &exception_
		, receiveInfo
		, (const CEERCV_SystemMessage_request_seq_ *)&request
		, &error
		, (CEERCV_SystemMessage_reply_seq_ *)&reply);

#ifdef NSK_QS
	sts = ((CNSKListenerQS*)GTransport.m_listener)->QS_REPLYX((const char*)reply._buffer, reply._length,receiveInfo->message_tag,error);
#else
	sts = REPLYX ( (char*)reply._buffer, reply._length, OMITREF, receiveInfo->message_tag,error);
#endif
	DEALLOCATE_TEMP_MEMORY((CEE_handle_def *)call_id_);
}
コード例 #2
0
void CTCPIPSystemSrvr::send_error(short error, short error_detail, const CEE_handle_def *call_id_)
{
	long tag;
	short fnum;
	_cc_status cc;
	short wcount;
	long wtimeout = 10 * 100;

	if (m_nSocketFnum < 0)
		goto bailout;
	m_rhdr.error = error;
	m_rhdr.error_detail = error_detail;
	m_rhdr.hdr_type = SRVR_TRANSPORT_ERROR;
	memcpy(m_IObuffer,&m_rhdr,sizeof(m_rhdr));
	if (m_rhdr.swap == SWAP_YES)
		HEADER_swap((HEADER*)m_IObuffer);
	if (send_nw2(m_nSocketFnum, m_IObuffer, sizeof(HEADER), 0, 1) <0)
		goto bailout;
	fnum = m_nSocketFnum;
	cc = AWAITIOX(&fnum,,&wcount, &tag, wtimeout);
	if (!_status_eq(cc))
		goto bailout;
bailout:
	DEALLOCATE_TEMP_MEMORY(&m_call_id);
}
コード例 #3
0
CEE_status CTCPIPSystemSrvr::send_response(char* buffer, unsigned long message_length, const CEE_handle_def *call_id_)
{
	SRVRTRACE_ENTER(FILE_TSS+11);
	CEE_status retcode = WRITE_TCPIP_RESPONSE(this, message_length);
	if (GTransport.m_TempMemory_list.m_list_length )
		DEALLOCATE_TEMP_MEMORY(&m_call_id);
	SRVRTRACE_EXIT(FILE_TSS+11);
	return retcode;
}
コード例 #4
0
void CTCPIPSystemSrvr::send_error(short error, short error_detail, const CEE_handle_def *call_id_)
{
	if (m_nSocketFnum >= 0)
    {
        m_rhdr.error = error;
        m_rhdr.error_detail = error_detail;
        m_rhdr.hdr_type = SRVR_TRANSPORT_ERROR;
        memcpy(m_IObuffer,&m_rhdr,sizeof(m_rhdr));
	    if (m_rhdr.swap == SWAP_YES)
		   HEADER_swap((HEADER*)m_IObuffer);
        if (send(m_nSocketFnum, m_IObuffer, sizeof(HEADER), 0) <= 0)
        {   // Error in send
            error_cleanup();
        }
    }

	if (GTransport.m_TempMemory_list.m_list_length)
		DEALLOCATE_TEMP_MEMORY(&m_call_id);
}
コード例 #5
0
/*
 * Asynchronous response for
 * operation 'IOMessage_res'
 */
CEE_status
IOMessage_short_res_(
    /* In    */ short message_tag
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ const CEERCV_IOMessage_exc_ *exception_
  , /* In    */ IDL_short error
  , /* In    */ const CEERCV_IOMessage_reply_seq_ *reply
  )
{
	CEE_status sts = CEE_SUCCESS;
	IDL_short m_error = error;

	if (exception_->exception_nr == CEERCV_IOMessage_decline_exn_)
		m_error = 2;

#ifdef NSK_QS
	sts = ((CNSKListenerQS*)GTransport.m_listener)->QS_REPLYX((const char*)reply->_buffer, reply->_length, message_tag,m_error);
#else
	sts = REPLYX ( (char *)reply->_buffer, reply->_length, OMITREF, message_tag,m_error);
#endif
	DEALLOCATE_TEMP_MEMORY((CEE_handle_def *)call_id_);
	return sts;
}
コード例 #6
0
void
IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* Out   */ CEERCV_IOMessage_exc_ *exception_
  , /* In    */ const FS_Receiveinfo_Type *receiveInfo
  , /* In    */ IDL_short dialogInfo
  , /* In    */ const CEERCV_IOMessage_request_seq_ *request
  , /* Out   */ IDL_short *error
  , /* Out   */ CEERCV_IOMessage_reply_seq_ *reply
  )
{
	CEE_status sts = CEE_SUCCESS;

	CEE_handle_def call_id;
	memcpy(&call_id, call_id_, sizeof(CEE_handle_def));

	char* buffer = (char *)request->_buffer + sizeof(HEADER);
	long length = request->_length - sizeof(HEADER);

	HEADER* hdr = (HEADER*)request->_buffer;
	CFSystemSrvr* pnode;

	unsigned short max_reply_count = receiveInfo->max_reply_count;
	short message_tag = receiveInfo->message_tag;
	*error = 0;
	exception_->exception_nr = 0;
	reply->_length = 0;
	reply->_buffer = NULL;

	switch(hdr->hdr_type)
	{
	case WRITE_REQUEST_FIRST:
		pnode = GTransport.m_FSystemSrvr_list->find_node(receiveInfo);
		if (pnode == NULL)
		{
			*error = SRVR_ERR_NODE_WRITE_REQUEST_FIRST;
			IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply);
			return;
		}
		RESET_ERRORS((long)pnode);
		pnode->m_message_tag = message_tag;
		memset(&pnode->m_whdr,0,sizeof(HEADER));
		memcpy(&pnode->m_rhdr,hdr,sizeof(HEADER));
		if(pnode->r_allocate(hdr->total_length) == NULL)
		{
			*error = SRVR_ERR_MEMORY_ALLOCATE;
			IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply);
			return;
		}
		memcpy(pnode->m_rbuffer, buffer, length);
		pnode->m_curptr = pnode->m_rbuffer + length;
		IOMessage_short_res_(message_tag, &call_id, exception_, *error, reply);
		break;
	case WRITE_REQUEST_NEXT:
		pnode = GTransport.m_FSystemSrvr_list->find_node(receiveInfo);
		if (pnode == NULL)
		{
			*error = SRVR_ERR_NODE_WRITE_REQUEST_NEXT;
			IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply);
			return;
		}
		RESET_ERRORS((long)pnode);
		pnode->m_message_tag = message_tag;
		memset(&pnode->m_whdr,0,sizeof(HEADER));
		memcpy(pnode->m_curptr, buffer, length);
		pnode->m_curptr += length;
		sts = IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply);
		break;
	case READ_RESPONSE_FIRST:
	case READ_RESPONSE_NEXT:
		pnode = GTransport.m_FSystemSrvr_list->find_node(receiveInfo);
		if (pnode == NULL)
		{ 
			if (hdr->hdr_type == READ_RESPONSE_FIRST)
				*error = SRVR_ERR_NODE_READ_RESPONSE_FIRST;
			else
				*error = SRVR_ERR_NODE_READ_RESPONSE_NEXT;
			IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply);
			return;
		}
		RESET_ERRORS((long)pnode);
		pnode->m_message_tag = message_tag;
		memset(&pnode->m_whdr,0,sizeof(HEADER));
		if (hdr->hdr_type == READ_RESPONSE_FIRST)
		{
			memcpy(&call_id, &pnode->m_call_id, sizeof(CEE_handle_def));
			pnode->m_max_reply_count = max_reply_count;
			if(pnode->m_trans_begin_tag != 0)
				RESUMETRANSACTION(pnode->m_trans_begin_tag);
			DISPATCH_IOMessage( (CEE_tag_def)pnode, &call_id, exception_, receiveInfo, dialogInfo, request, error, reply, hdr->operation_id );
			length = pnode->m_reply_count;
		}
		else
		{
			length = pnode->m_curlength;
			buffer = pnode->m_curptr;
			if (length > max_reply_count)
				length = max_reply_count;
			reply->_length = length;
			reply->_buffer = (IDL_octet *)buffer;
			IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply);
		}
		pnode->m_curlength -= length;
		pnode->m_curptr += length;

		if (pnode->m_curlength == 0)
		{
			if (pnode->m_rbuffer != NULL)
			{
				delete[] pnode->m_rbuffer;
				pnode->m_rbuffer = NULL;
			}
			if (pnode->m_wbuffer != NULL)
			{
				delete[] pnode->m_wbuffer;
				pnode->m_wbuffer = NULL;
			}
			DEALLOCATE_TEMP_MEMORY(&call_id);
		}
		break;
	case CLEANUP:
		GTransport.m_FSystemSrvr_list->cleanup_node(receiveInfo);
		IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply);
		break;
	}
}
コード例 #7
0
CEE_status CTCPIPSystemSrvr::send_response(char* buffer, unsigned long message_length, const CEE_handle_def *call_id_)
{
	CEE_status retcode = WRITE_TCPIP_RESPONSE(this, message_length);
	DEALLOCATE_TEMP_MEMORY(&m_call_id);
	return retcode;
}