STDMETHODIMP GuestSessionWrap::COMGETTER(ProtocolVersion)(ULONG *aProtocolVersion) { LogRelFlow(("{%p} %s: enter aProtocolVersion=%p\n", this, "GuestSession::getProtocolVersion", aProtocolVersion)); VirtualBoxBase::clearError(); HRESULT hrc; try { CheckComArgOutPointerValidThrow(aProtocolVersion); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) throw autoCaller.rc(); hrc = getProtocolVersion(aProtocolVersion); } catch (HRESULT hrc2) { hrc = hrc2; } catch (...) { hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); } LogRelFlow(("{%p} %s: leave *aProtocolVersion=%RU32 hrc=%Rhrc\n", this, "GuestSession::getProtocolVersion", *aProtocolVersion, hrc)); return hrc; }
char* CTPMessage::toByte() { int totalMessageSize = 2; // version and genericCommand int totalPackageSize = 0, i = 0; CTPParam* param = (CTPParam*)params.front(); while(param) { totalMessageSize += 2; totalMessageSize += param->getValueLength(); param = (CTPParam*) params.next(); } totalPackageSize = totalMessageSize +2; setPackageLength(totalPackageSize); // the whole package setBufferLength(totalPackageSize); // the same package that is in the buffer buffer = new char[totalPackageSize]; if (totalMessageSize < 255) { buffer[0] = 0x00; buffer[1] = (unsigned char)totalMessageSize; } else { int upper = 0, down = 0; upper = totalMessageSize >> 8 ; buffer[0] = (unsigned char)(upper); down = totalMessageSize; upper <<= 8; down = down ^ upper; buffer[1] = (unsigned char)down; } buffer[2] = getProtocolVersion(); buffer[3] = getGenericCommand(); char* p; if (totalPackageSize == 4) { goto finally; } p = &buffer[4]; param = (CTPParam*)params.front(); while(param) { p[i++] = param->getParamCode(); p[i++] = param->getValueLength(); memcpy(&p[i], param->getValue(), param->getValueLength()); i += param->getValueLength(); param = (CTPParam*) params.next(); } finally: return buffer; }
IncomingRTPPkt::IncomingRTPPkt(const unsigned char* const block, size_t len) : RTPPacket(block,len) { // first, perform validity check: // 1) check protocol version // 2) it is not an SR nor an RR // 3) consistent length field value (taking CC value and P and // X bits into account) if ( getProtocolVersion() != CCRTP_VERSION || (getPayloadType() & RTP_INVALID_PT_MASK) == RTP_INVALID_PT_VALUE) { /* || getPayloadSize() <= 0 ) { */ headerValid = false; return; } headerValid = true; cachedTimestamp = getRawTimestamp(); cachedSeqNum = ntohs(getHeader()->sequence); cachedSSRC = ntohl(getHeader()->sources[0]); }
void plugin::requestProperties(int sessionid) { Q_UNUSED(sessionid); { ServiceData sc = ServiceData::createNotification(PLUGIN_ID, "pulse.version" ); sc.setData("protocol", getProtocolVersion()); sc.setData("server", getServerVersion()); changeProperty(sc.getData()); } { ServiceData sc = ServiceData::createModelReset( "pulse.channels", "sinkid" ); changeProperty(sc.getData()); } QList<PulseChannel> channels = getAllChannels(); foreach(PulseChannel channel, channels) { ServiceData sc = ServiceData::createModelChangeItem( "pulse.channels" ); sc.setData("sinkid", channel.sinkid); sc.setData("mute", channel.mute); sc.setData("volume", channel.volume); changeProperty(sc.getData()); }
HRESULT GuestDnDBase::i_getProtocolVersion(ULONG *puVersion) { int rc = getProtocolVersion((uint32_t *)puVersion); return RT_SUCCESS(rc) ? S_OK : E_FAIL; }