⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 giopimpl11.cc

📁 编译工具
💻 CC
📖 第 1 页 / 共 4 页
字号:
    if (disgard)      inputSkipWholeMessage(g);    if (g->pd_currentInputBuffer) {      g->releaseInputBuffer(g->pd_currentInputBuffer);      g->pd_currentInputBuffer = 0;    }  }  if (g->pd_rdlocked) {    omni_tracedmutex_lock sync(*omniTransportLock);    g->rdUnLock();  }}////////////////////////////////////////////////////////////////////////voidgiopImpl11::unmarshalReplyHeader(giopStream* g) {  char* hdr = (char*)g->pd_currentInputBuffer +                      g->pd_currentInputBuffer->start;  if ((GIOP::MsgType)hdr[7] != GIOP::Reply) {    // Unexpected reply. The other end is terribly confused. Drop the    // connection and died.    inputTerminalProtocolError(g);    // Never reach here.  }  GIOP_C& giop_c = *((GIOP_C*) g);  cdrStream& s = *((cdrStream*)g);  IOP::ServiceContextList sctxts;  if (omniInterceptorP::clientReceiveReply) {    sctxts <<= s;  }  else {    // Skip service context    CORBA::ULong svcccount;    CORBA::ULong svcctag;    CORBA::ULong svcctxtsize;    svcccount <<= s;    while (svcccount-- > 0) {      svcctag <<= s;      svcctxtsize <<= s;      s.skipInput(svcctxtsize);    }  }  CORBA::ULong id;  id <<= s;  giop_c.replyId(id);  CORBA::ULong v;  v <<= s;  switch (v) {  case GIOP::SYSTEM_EXCEPTION:  case GIOP::NO_EXCEPTION:  case GIOP::USER_EXCEPTION:  case GIOP::LOCATION_FORWARD:    break;  default:    // Should never receive anything other that the above    // Same treatment as wrong header    inputTerminalProtocolError(g);    // Never reach here.    break;  }  giop_c.replyStatus((GIOP::ReplyStatusType)v);  if (omniInterceptorP::clientReceiveReply) {    omniInterceptors::clientReceiveReply_T::info_T info(giop_c, sctxts);    omniInterceptorP::visit(info);  }}////////////////////////////////////////////////////////////////////////voidgiopImpl11::unmarshalLocateReply(giopStream* g) {  char* hdr = (char*)g->pd_currentInputBuffer +                      g->pd_currentInputBuffer->start;  if ((GIOP::MsgType)hdr[7] != GIOP::LocateReply) {    // Unexpected reply. The other end is terribly confused. Drop the    // connection and died.    inputTerminalProtocolError(g);    // Never reach here.  }  GIOP_C& giop_c = *((GIOP_C*) g);  cdrStream& s = *((cdrStream*)g);  CORBA::ULong id;  id <<= s;  giop_c.replyId(id);  CORBA::ULong v;  v <<= s;  switch (v) {  case GIOP::UNKNOWN_OBJECT:  case GIOP::OBJECT_HERE:  case GIOP::OBJECT_FORWARD:    break;  default:    // Should never receive anything other that the above    // Same treatment as wrong header    inputTerminalProtocolError(g);    // Never reach here.    break;  }  giop_c.locateStatus((GIOP::LocateStatusType)v);}////////////////////////////////////////////////////////////////////////voidgiopImpl11::unmarshalWildCardRequestHeader(giopStream* g) {  g->inputMatchedId(1);  char* hdr = (char*)g->pd_currentInputBuffer +                      g->pd_currentInputBuffer->start;  ((GIOP_S*)g)->requestType((GIOP::MsgType)hdr[7]);  switch (((GIOP_S*)g)->requestType()) {  case GIOP::Request:  case GIOP::LocateRequest:  case GIOP::CancelRequest:    break;  case GIOP::CloseConnection:    inputRaiseCommFailure(g);    break;  default:    inputTerminalProtocolError(g);    // Never reach here.    break;  }}////////////////////////////////////////////////////////////////////////voidgiopImpl11::unmarshalRequestHeader(giopStream* g) {  GIOP_S& giop_s = *((GIOP_S*) g);  cdrStream& s = *((cdrStream*)g);    giop_s.service_contexts() <<= s;  CORBA::ULong   vl;  CORBA::Boolean vb;  // request id  vl <<= s;  giop_s.requestId(vl);  // response expected  vb = s.unmarshalBoolean();  giop_s.response_expected(vb);  giop_s.result_expected(1);  // object key  vl <<= s;  if (!s.checkInputOverrun(1,vl)) {    OMNIORB_THROW(MARSHAL,MARSHAL_InvalidVariableLenComponentSize,		  CORBA::COMPLETED_NO);  }  giop_s.keysize(vl);  s.get_octet_array(giop_s.key(),vl);  // operation  vl <<= s;  if (!vl || !s.checkInputOverrun(1,vl)) {    OMNIORB_THROW(MARSHAL,MARSHAL_InvalidVariableLenComponentSize,		  CORBA::COMPLETED_NO);  }  giop_s.set_operation_size(vl);  char* op = giop_s.operation();  s.get_octet_array((CORBA::Octet*)op,vl);  op[vl-1] = '\0';  // principal  vl <<= s;  if (!s.checkInputOverrun(1,vl)) {    OMNIORB_THROW(MARSHAL,MARSHAL_InvalidVariableLenComponentSize,		  CORBA::COMPLETED_NO);  }  giop_s.set_principal_size(vl);  giop_s.get_octet_array(giop_s.principal(), vl);}////////////////////////////////////////////////////////////////////////voidgiopImpl11::unmarshalLocateRequest(giopStream* g) {  GIOP_S& giop_s = *((GIOP_S*) g);  cdrStream& s = *((cdrStream*)g);  CORBA::ULong vl;  // request ID  vl <<= s;  giop_s.requestId(vl);  // object key  vl <<= s;  if (!s.checkInputOverrun(1,vl)) {    OMNIORB_THROW(MARSHAL,MARSHAL_InvalidVariableLenComponentSize,		  CORBA::COMPLETED_NO);  }  giop_s.keysize(vl);  s.get_octet_array(giop_s.key(),vl);}////////////////////////////////////////////////////////////////////////size_tgiopImpl11::inputRemaining(giopStream* g) {  if (g->inputExpectAnotherFragment()) {    return orbParameters::giopMaxMsgSize - currentInputPtr(g);  }  else {    return (g->inputFragmentToCome() + ((omni::ptr_arith_t)g->pd_inb_end -					(omni::ptr_arith_t)g->pd_inb_mkr));  }}////////////////////////////////////////////////////////////////////////voidgiopImpl11::inputNewFragment(giopStream* g) {  if (g->inputMatchedId()) {    if (g->pd_currentInputBuffer) {      g->releaseInputBuffer(g->pd_currentInputBuffer);      g->pd_currentInputBuffer = 0;    }    if (!g->pd_input) {      g->pd_currentInputBuffer = g->inputMessage();    }    else {      g->pd_currentInputBuffer = g->pd_input;      g->pd_input = g->pd_currentInputBuffer->next;      g->pd_currentInputBuffer->next = 0;    }  }  else {    // We keep the buffer around until the id of the reply is established.    giopStream_Buffer** pp = &g->pd_input;    while (*pp) {      pp = &((*pp)->next);    }    *pp = g->pd_currentInputBuffer;    g->pd_currentInputBuffer = 0;    g->pd_currentInputBuffer = g->inputMessage();  }  char* hdr = (char*)g->pd_currentInputBuffer +                      g->pd_currentInputBuffer->start;  if (hdr[4] != 1 || hdr[5] != 1) {    inputTerminalProtocolError(g);    // never reach here.  }        CORBA::Boolean bswap = (((hdr[6] & 0x1) == _OMNIORB_HOST_BYTE_ORDER_)			  ? 0 : 1 );  if (hdr[7] != (char)GIOP::Fragment || bswap != g->pd_unmarshal_byte_swap) {    inputTerminalProtocolError(g);    // never reach here  }  g->pd_inb_mkr = (void*)(hdr + 12);  g->pd_inb_end = (void*)((omni::ptr_arith_t)g->pd_currentInputBuffer + 			  g->pd_currentInputBuffer->last);  g->inputExpectAnotherFragment(((hdr[6] & 0x2) ? 1 : 0));  g->inputMessageSize(g->inputMessageSize() + 		      g->pd_currentInputBuffer->size - 12);  g->inputFragmentToCome(g->pd_currentInputBuffer->size - 			 (g->pd_currentInputBuffer->last -			  g->pd_currentInputBuffer->start));}////////////////////////////////////////////////////////////////////////voidgiopImpl11::getInputData(giopStream* g,omni::alignment_t align,size_t sz) { again:  omni::ptr_arith_t last = omni::align_to((omni::ptr_arith_t)g->pd_inb_mkr,					  align);  omni::ptr_arith_t end = last + sz;  if ( end <= (omni::ptr_arith_t) g->pd_inb_end) {    return;  }  else {    // Invariant check     // Either the full message is already in the buffer or the part that is    // in the buffer always ends at an 8 byte aligned boundary.    // Also remember that sz is <= 8 always!    size_t extra = end - (omni::ptr_arith_t) g->pd_inb_end;    if (extra != sz) {      if ( !(g->inputFragmentToCome() || g->inputExpectAnotherFragment()) ) {	// The full message is already in the buffer. The unmarshalling	// code is asking for more. This is an error causes by the received	// data. We'll let the code below to raise a MARSHAL exception	sz = extra;            // in case sz == 0      }      else {	if (g->inputExpectAnotherFragment()) {	  // The incoming message is fragmented at the wrong boundary!!!	  inputTerminalProtocolError(g);	  // never reach here	}	// Very bad. Should never happen given our invariant.	{	  if( omniORB::trace(1) ) {	    omniORB::logger l;	    l << "Fatal error in unmarshalling message from "	      << g->pd_strand->connection->peeraddress()	      << ", invariant was violated at "	      << __FILE__ 		      << ":" << __LINE__ << '\n';	  }	}	OMNIORB_ASSERT(0);	// never reach here.      }    }  }  if (g->inputFragmentToCome() < sz && !g->inputExpectAnotherFragment()) {    if (!g->inputMatchedId()) {      // Because this error occurs when the id of the reply has not      // been established. We have to treat this as an error on the      // connection. Other threads that are reading from this connection      // will notice this as well.      g->pd_strand->state(giopStrand::DYING);    }    OMNIORB_THROW(MARSHAL,MARSHAL_PassEndOfMessage,		  (CORBA::CompletionStatus)g->completion());  }  if (!g->inputFragmentToCome()) {    inputNewFragment(g);    if (g->inputMessageSize() > orbParameters::giopMaxMsgSize) {      OMNIORB_THROW(MARSHAL,MARSHAL_MessageSizeExceedLimit,		    (CORBA::CompletionStatus)g->completion());    }    goto again;  }  // Reach here if we have some bytes to fetch for the current fragment  if (g->inputMatchedId()) {    if (g->pd_currentInputBuffer) {      g->releaseInputBuffer(g->pd_currentInputBuffer);      g->pd_currentInputBuffer = 0;    }    if (!g->pd_input) {      g->pd_currentInputBuffer = g->inputChunk(g->inputFragmentToCome());    }    else {      g->pd_currentInputBuffer = g->pd_input;      g->pd_input = g->pd_currentInputBuffer->next;      g->pd_currentInputBuffer->next = 0;    }  }  else {    // We keep the buffer around until the id of the reply is established.    giopStream_Buffer** pp = &g->pd_input;    while (*pp) {      pp = &((*pp)->next);    }    *pp = g->pd_currentInputBuffer;    g->pd_currentInputBuffer = 0;    g->pd_currentInputBuffer = g->inputChunk(g->inputFragmentToCome());  }  g->pd_inb_mkr = (void*)((omni::ptr_arith_t)g->pd_currentInputBuffer + 			  g->pd_currentInputBuffer->start);  g->pd_inb_end = (void*)((omni::ptr_arith_t)g->pd_currentInputBuffer + 			  g->pd_currentInputBuffer->last);  g->inputFragmentToCome(g->inputFragmentToCome() - 			 (g->pd_currentInputBuffer->last -			  g->pd_currentInputBuffer->start));}////////////////////////////////////////////////////////////////////////voidgiopImpl11::skipInputData(giopStream* g,size_t sz) {  copyInputData(g,0,sz,omni::ALIGN_1);}////////////////////////////////////////////////////////////////////////voidgiopImpl11::copyInputData(giopStream* g,void* b, size_t sz,			  omni::alignment_t align) {  // If b == 0, we don't actually copy the data but just skip <sz> bytes.  omni::ptr_arith_t last = omni::align_to((omni::ptr_arith_t)g->pd_inb_mkr,					  align);  if ( last > (omni::ptr_arith_t) g->pd_inb_end ) {    // Invariant check     // Either the full message is already in the buffer or the part that is    // in the buffer always ends at an 8 byte aligned boundary.    if ( !(g->inputFragmentToCome() || g->inputExpectAnotherFragment()) ) {      // The full message is already in the buffer. The unmarshalling      // code is asking for more. This is an error causes by the received      // data.      if (!g->inputMatchedId()) {	// Because this error occurs when the id of the reply has not	// been established. We have to treat this as an error on the	// connection. Other threads that are reading from this connection	// will notice this as well.	g->pd_strand->state(giopStrand::DYING);      }      OMNIORB_THROW(MARSHAL,MARSHAL_PassEndOfMessage,		    (CORBA::CompletionStatus)g->completion());    }    else {      if (g->inputExpectAnotherFragment()) {	// The incoming message is fragmented at the wrong boundary!!!	inputTerminalProtocolError(g);	// never reach here      }      // Very bad. Should never happen given our invariant.      {	if( omniORB::trace(1) ) {	  omniORB::logger l;	  l << "Fatal error in unmarshalling message from "	    << g->pd_strand->connection->peeraddress()	    << ", invariant was violated at "	    << __FILE__ 		    << ":" << __LINE__ << '\n';	}      }      OMNIORB_ASSERT(0);      // never reach here.    }  }  g->pd_inb_mkr = (void*) last;  while (sz) {    size_t avail = (omni::ptr_arith_t) g->pd_inb_end - 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -