PoC TBCP消息解析和构造的JAVA实现

TBCPMessageFactory.java

 

/** * 文件名: TBCPMessageFactory.java */ package tbcpstack; import java.text.MessageFormat; import org.apache.log4j.Logger; import TBCPException; /** * * TODO TBCP消息构建工厂 */ public class TBCPMessageFactory { /** * Logger for this class */ private static final Logger logger = Logger.getLogger(TBCPMessageFactory.class); private static final String POCNAME = "PoC1"; /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Request消息格式进行构造。 * * @param ssrc * SSRC of PoC Client requesting permission to send a talk burst * @param priority * 只能为1、2、3。 1 - normal priority;2 - high priority;3 - * pre-emptivepriority * @return bytes of TalkBurstRequest * @throws TBCPException */ public static byte[] createTBCPTalkBurstRequest(long ssrc, int priority) throws TBCPException { if ((1 <= priority) && (priority <= 3)) { byte[] data = new byte[16]; data[0] = 102;// TB-priority-level data[1] = 2;// TB-priority-length byte[] priorityValueBytes = ByteConversion.uIntIntToByteWord(priority);// TB-priority // value data[2] = priorityValueBytes[0]; data[3] = priorityValueBytes[1]; data[4] = 103;// Time-stamp data[5] = 8;// Time-stamp-length // Timestamp value byte[] timeStampValueBytes = ByteConversion.longToByte(TimeStamp.getCurrentTime().ntpValue()); for (int i = 0; i < 8; i++) { data[i + 6] = timeStampValueBytes[i]; } data[14] = 0;// 后两位要补为0 data[15] = 0; byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_REQUEST, name, data); } else { logger.error("Priority if out of index."); throw new TBCPException("Cause TBCPCreateException when createTBCPTalkBurstRequest.", new IllegalArgumentException("Priority if out of index. priority=" + priority)); } } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Granted消息格式进行构造。 * * @param ssrc * SSRC of PoC Server performing the Controlling PoC Function * @param stopTalkingTimeValue * 0 = The value of timer T2 is unknown; 1 ... 65534 = The value * of timer T2 in seconds; 65535 = The value of T2 is infinity. * @param participants * 0 = The number of Participant is not known; 1 ... 65534 = The * number of Participants in the PoC Session including the * speaker; 65535 = 65535 or more Participants in the PoC Session * including the speaker. * @return bytes of TalkBurstGranted * @throws TBCPException * * */ public static byte[] createTBCPTalkBurstGranted(long ssrc, int stopTalkingTimeValue, int participants) throws TBCPException { if ((0 <= stopTalkingTimeValue) && (stopTalkingTimeValue <= 65535) && (0 <= participants) && (participants <= 65535)) { byte[] data = new byte[8];// new byte[0]; data[0] = 101;// T2-timer data[1] = 2;// T2-length byte[] stopTalkingTimeValueBytes = ByteConversion.uIntIntToByteWord(stopTalkingTimeValue); data[2] = stopTalkingTimeValueBytes[0];// Stop talking time value; data[3] = stopTalkingTimeValueBytes[1];// Stop talking time value; data[4] = 100;// P-count data[5] = 2;// P-count-length byte[] participantsBytes = ByteConversion.uIntIntToByteWord(participants); data[6] = participantsBytes[0];// Participants data[7] = participantsBytes[1];// Participants byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_GRANTED, name, data); } else { logger.error("StopTalkingTimeValue or Participants is out of index."); throw new TBCPException( "Cause TBCPCreateException when createTBCPTalkBurstGranted.", new IllegalArgumentException( MessageFormat .format( "StopTalkingTimeValue or Participants is out of index.StopTalkingTimeValue={0},Participants={1}", stopTalkingTimeValue, participants))); } } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Deny消息格式进行构造。 * * @param ssrc * SSRC of PoC Server performing the Controlling PoC Function * @param reasonCode * 取值从0-5 0 - there is no reason in the Reason Phrase field * 1 - Another PoC User has permission * 2 - Internal PoC Server Function error * 3 - Only one Participant in the PoC Session * 4 - Retry-after timer has not expired * 5 - Listen only * 6 - No resources available * 255 - Other reason * @param reasonPhrase * The text string SHALL use the same encoding as the text * strings in the SDES item CNAME as specified in [RFC3550]. * @return bytes of TalkBurstDeny * @throws TBCPException * */ public static byte[] createTBCPTalkBurstDeny(long ssrc, int reasonCode, String reasonPhrase) throws TBCPException { if ((0 <= reasonCode) && (reasonCode <= 255)) { byte reason; if (reasonCode > 127) { reason = (byte) (reasonCode - 256); } else { reason = (byte) reasonCode; } byte[] data; if (reasonPhrase != null) { byte[] reasonPhraseBytes = reasonPhrase.getBytes(); int res = 0; if (((reasonPhraseBytes.length - 2) % 4) != 0) res = 4 - ((reasonPhraseBytes.length - 2) % 4); int length = 4; if (reasonPhraseBytes.length > 2) { length = 2 + reasonPhraseBytes.length + res; } data = new byte[length]; data[0] = reason;// Reason code // Reason Phrase Bytes Length data[1] = (byte) reasonPhraseBytes.length; System.arraycopy(reasonPhraseBytes, 0, data, 2, reasonPhraseBytes.length); } else { data = new byte[4]; data[0] = reason; } byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_DENY, name, data); } else { logger.error("The reason code is out of index."); throw new TBCPException("Cause TBCPCreateException when createTBCPTalkBurstDeny", new IllegalArgumentException(MessageFormat.format("The reason code is out of index.reasonCode={0}", reasonCode))); } } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Release消息格式进行构造。 包含最后一个RTP包的sequence number。 * * @param ssrc * SSRC of PoC Client with permission to send a talk burst * @param lastRtpPktSeqNum * sequence number of last packet * @param ignoreSequenceNumber * 表示是否忽略Sequence Number true为忽略 false为序列号有效 * @return bytes of TalkBurstRelease */ public static byte[] createTBCPTalkBurstRelease(long ssrc, int lastRtpPktSeqNum, boolean ignoreSequenceNumber) { byte[] data = new byte[4]; byte[] lastSeqNumBytes = ByteConversion.uIntIntToByteWord(lastRtpPktSeqNum); data[0] = lastSeqNumBytes[0];// 最后一个RTP包的sequence number data[1] = lastSeqNumBytes[1];// 最后一个RTP包的sequence number if (ignoreSequenceNumber) { data[2] = -128;// 比特位第16位为0,表示序列号有效,data[2]为二进制[0]0000000; // 比特位第16位为1,表示序列号无效,data[2]为二进制[1]0000000。 } else { data[2] = 0; } data[3] = 0; byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_RELEASE, name, data); } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Idle消息格式进行构造。 * * @param ssrc * SSRC of PoC Server performing the Controlling PoC Function * @return bytes of TalkBurstIdle */ public static byte[] createTBCPTalkBurstIdle(long ssrc) { byte[] data = new byte[0]; byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_IDLE, name, data); } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Taken消息格式进行构造。 * * @param ssrcOfPoCServer * SSRC of PoC Server performing the Controlling PoC Function * @param ssrcOfPoCClient * SSRC of PoC Client granted a permission to send a Talk Burst * @param CNAME * SIPURI * @param NAME * DisplayName * @param participants * 0 = The number of Participant is not known; 1 ... 65534 = The * number of Participants in the PoC Session including the * speaker; 65535 = 65535 or more Participants in the PoC Session * including the speaker. * @param ackExpected * true为Subtype: TBCP Talk Burst Taken (ack expected) (18) * false为Subtype: TBCP Talk Burst Taken (no ack expected) (2) * @return bytes of TalkBurstTaken * */ public static byte[] createTBCPTalkBurstTaken(long ssrcOfPoCServer, long ssrcOfPoCClient, String CNAME, String NAME, int participants, boolean ackExpected) { // The SSRC field in the application dependent data of the Talk Burst // Taken message SHALL carry, either; // 1. the SSRC of the PoC Client that has been granted a permission to // send a Talk Burst, if known by the PoC Server, or; // 2. the SSRC field with all 32 bits set to '1'. In this case the // receiving PoC Client SHALL ignore the SSRC field byte[] ssrcOfPoCClientBytes = ByteConversion.uIntLongToByteWord(ssrcOfPoCClient); byte[] cnameBytes = CNAME.getBytes(); byte[] nameBytes = NAME.getBytes(); byte[] participantsBytes = ByteConversion.uIntIntToByteWord(participants); int length; if ((0 <= participants) && (participants <= 65535)) { int sdesItemsLength = (cnameBytes.length + nameBytes.length + 4) % 4; if (sdesItemsLength != 0) { length = ssrcOfPoCClientBytes.length + cnameBytes.length + nameBytes.length + 4 + 4 - sdesItemsLength + 4; } else { length = ssrcOfPoCClientBytes.length + cnameBytes.length + nameBytes.length + 4 + 4; } } else { int sdesItemsLength = (cnameBytes.length + nameBytes.length + 4) % 4; if (sdesItemsLength != 0) { length = ssrcOfPoCClientBytes.length + cnameBytes.length + nameBytes.length + 4 + 4 - sdesItemsLength; } else { length = ssrcOfPoCClientBytes.length + cnameBytes.length + nameBytes.length + 4; } } int count = 0; byte[] data = new byte[length]; System.arraycopy(ssrcOfPoCClientBytes, 0, data, count, ssrcOfPoCClientBytes.length); count += ssrcOfPoCClientBytes.length; byte[] cnameFlag = new byte[2]; cnameFlag[0] = 0x01;// 0x01表示CNAME cnameFlag[1] = (byte) cnameBytes.length;// 表示CNAME的Length System.arraycopy(cnameFlag, 0, data, count, 2); count += 2; System.arraycopy(cnameBytes, 0, data, count, cnameBytes.length); count += cnameBytes.length; byte[] nameFlag = new byte[2]; nameFlag[0] = 0x02;// 0x02表示NAME nameFlag[1] = (byte) nameBytes.length;// 表示NAME的Length System.arraycopy(nameFlag, 0, data, count, 2); count += 2; System.arraycopy(nameBytes, 0, data, count, nameBytes.length); count += nameBytes.length; if ((0 <= participants) && (participants <= 65535)) { byte[] participantsItemBytes = new byte[4]; participantsItemBytes[0] = 100;// P-count participantsItemBytes[1] = 2;// P-count-length participantsItemBytes[2] = participantsBytes[0];// Participants participantsItemBytes[3] = participantsBytes[1];// Participants System.arraycopy(participantsItemBytes, 0, data, count, participantsItemBytes.length); } byte[] name = POCNAME.getBytes(); if (ackExpected) { return prepareRTCPAppPacket(ssrcOfPoCServer, TBCPMessageType.TBCP_TAKEN_WITH_ACK, name, data); } else { return prepareRTCPAppPacket(ssrcOfPoCServer, TBCPMessageType.TBCP_TAKEN, name, data); } } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Revoke消息格式进行构造。 * * @param ssrc * SSRC of PoC Server performing the Controlling PoC Function * @param reasonCode * 取值从1-4 1 - Only one PoC User 2 - Talk burst too long 3 - No * permission to send a Talk Burst 4 - Talk Burst pre-empted * @param additionalInformation * 当reasonCode为2时为PoC Client重传Talk Burst的时间, * reasonCode为1、3、4时,additional information取0填充。 * @throws TBCPException * @return bytes of TBCPTalkBurstRevoke */ public static byte[] createTBCPTalkBurstRevoke(long ssrc, int reasonCode, int additionalInformation) throws TBCPException { byte[] name = POCNAME.getBytes(); switch (reasonCode) { case 1: { byte[] data = new byte[4]; byte[] reasonCodeBytes = ByteConversion.uIntIntToByteWord(reasonCode); data[0] = reasonCodeBytes[0];// Reason code data[1] = reasonCodeBytes[1];// Reason code // No additional information SHALL be included. Hence, // the first 16 bits in the additional information field SHALL // be populated with zeros. data[2] = 0x00;// additional information data[3] = 0x00;// additional information return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_REVOKE, name, data); } case 2: { if ((0 <= additionalInformation) && (additionalInformation <= 65535)) { byte[] data = new byte[4]; byte[] reasonCodeBytes = ByteConversion.uIntIntToByteWord(reasonCode); byte[] additionalInformationBytes = ByteConversion.uIntIntToByteWord(additionalInformation); data[0] = reasonCodeBytes[0];// Reason code data[1] = reasonCodeBytes[1];// Reason code // As additional information the additional information // field carries a retry-after field where the 16 bits in // the additional information field is an integer number // giving the time in seconds when the PoC Client can // request permission to send a Talk Burst again. The timer // length should be a few seconds longer than the timer // value for the retry-after timer in the PoC Server // performing the Controlling PoC Function. data[2] = additionalInformationBytes[0];// additional // information data[3] = additionalInformationBytes[1];// additional // information return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_REVOKE, name, data); } else { logger.error("The Additional Information is out of index."); throw new TBCPException("Cause TBCPCreateException when createTBCPTalkBurstRevoke.", new IllegalArgumentException(MessageFormat.format( "The Additional Information is out of index.additionalInformation={0}", additionalInformation))); } } case 3: { byte[] data = new byte[4]; byte[] reasonCodeBytes = ByteConversion.uIntIntToByteWord(reasonCode); data[0] = reasonCodeBytes[0];// Reason code data[1] = reasonCodeBytes[1];// Reason code // No additional information SHALL be included. Hence, // the first 16 bits in the additional information field SHALL // be populated with zeros. data[2] = 0x00;// additional information data[3] = 0x00;// additional information return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_REVOKE, name, data); } case 4: { byte[] data = new byte[4]; byte[] reasonCodeBytes = ByteConversion.uIntIntToByteWord(reasonCode); data[0] = reasonCodeBytes[0];// Reason code data[1] = reasonCodeBytes[1];// Reason code // No additional information SHALL be included. Hence, // the first 16 bits in the additional information field SHALL // be populated with zeros. data[2] = 0x00;// additional information data[3] = 0x00;// additional information return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_REVOKE, name, data); } default: { logger.error("The Reason Code is out of index."); throw new TBCPException("Cause TBCPCreateException when createTBCPTalkBurstRevoke.", new IllegalArgumentException(MessageFormat.format("The Reason Code is out of index.reasonCode={0}", reasonCode))); } } } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Acknowledgement消息格式进行构造。 * * @param ssrc * SSRC of PoC Client sending the acknowledgement message * @param subtype * The application dependent data subtype field SHALL be the value of the subtype field found in the * message that is being acknowledged. * @param reasonCode * 取值为0、1、2。 0 - Accepted (Indicates that the PoC Client has accepted the incoming PoC Session.) 1 - Busy * (Indicates that the PoC Client has not accepted the incoming PoC Session, because it is busy.) 2 - Not * accepted (Indicates that the PoC Client has not accepted the incoming PoC Session.) * @return bytes of TalkBurstAcknowledgement * @throws TBCPException */ public static byte[] createTBCPTalkBurstAcknowledgement(long ssrc, int subtype, int reasonCode) throws TBCPException { if ((0 <= subtype) && (subtype <= 31)) { if ((0 <= reasonCode) && (reasonCode <= 2)) { byte[] data = new byte[4]; int i = ((subtype << 11) & 0xf800) + ((reasonCode) & 0x7ff); byte[] reasonCodeBytes = ByteConversion.uIntIntToByteWord(i); data[0] = reasonCodeBytes[0]; data[1] = reasonCodeBytes[1]; data[2] = 0x00; data[3] = 0x00; byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_ACK, name, data); } else { logger.error("The reason code is out of index."); throw new TBCPException("Cause TBCPCreateException when createTBCPTalkBurstAcknowledgement.", new IllegalArgumentException(MessageFormat.format( "The reason code is out of index.reasonCode={0}", reasonCode))); } } else { logger.error("The subtype is out of index."); throw new TBCPException("Cause TBCPCreateException when createTBCPTalkBurstAcknowledgement.", new IllegalArgumentException(MessageFormat.format("The subtype is out of index.subtype={0}", subtype))); } } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Request Queue Status Request消息格式进行构造。 * * The TBCP Talk Burst Request Queue Status Request message is a request from a PoC Client to get information about * the PoC Client's position in the Talk Burst request queue. * * @param ssrc * SSRC of PoC Client requesting queue status information * @return bytes of TBCPTalkBursRequestQueueStatusRequest * */ public static byte[] createTBCPTalkBurstRequestQueueStatusRequest(long ssrc) { byte[] data = new byte[0]; byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_QUEUE_STATUS_REQUEST, name, data); } /** * 按照OMA PoC UserPlane里规定的TBCP Talk Burst Request Queue Status * Response消息格式进行构造。 * * @param ssrc * SSRC of PoC Server performing the Controlling PoC Function * @param priority * 只能为1、2、3。(1 - normal priority, 2 - high priority, 3 - * pre-emptive priority) * @param position * 如果PoC Client不排队可以为0,最大值65535。 (The queue position field SHALL * have the value 0 if the PoC Client is un-queued. The queue * position field SHALL have the max value (65535) ) * @return bytes of TBCPTalkBurstRequestQueueStatusResponse * @throws TBCPException */ public static byte[] createTBCPTalkBurstRequestQueueStatusResponse(long ssrc, byte priority, int position) throws TBCPException { if ((0 <= position) && (position <= 65535) && (1 <= priority) && (priority <= 3)) { byte[] data = new byte[4]; data[0] = priority;// Priority byte[] positionBytes = ByteConversion.uIntIntToByteWord(position); data[1] = positionBytes[0];// Queue position data[2] = positionBytes[1];// Queue position data[3] = 0;// padding byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_QUEUE_STATUS_RESPONSE, name, data); } else { logger.error("Priority or Position is out of index."); throw new TBCPException("Cause TBCPCreateException when createTBCPTalkBurstRequestQueueStatusResponse.", new IllegalArgumentException(MessageFormat.format( "Priority or Position is out of index.priority={0},position={1}", priority, position))); } } /** * 按照OMA PoC UserPlane里规定的TBCP Disconnect消息格式进行构造。 * * The TBCP Disconnect message is sent by the PoC Server performing the Participating PoC Function to the PoC Client * to indicate that the PoC Session using a Pre-established Session has been released. * * @param ssrc * SSRC of PoC Server performing the Participating PoC function * @return bytes of TBCPDisconnect */ public static byte[] createTBCPDisconnect(long ssrc) { byte[] data = new byte[0]; byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_DISCONNECT, name, data); } /** * 按照OMA PoC UserPlane里规定的TBCP Connect消息格式进行构造。 * * @param ssrc * SSRC of PoC Server performing the Participating PoC function * @param bytesSDESItemContent * SDES item content includes the bit pattern ABCDEXXXXXXXXXXX, where each bit indicates if the optional SDES item is * included or not (1= included, 0=not included) according to the description below: * A= Identity of the Inviting PoC Client. * B= The Nick Name provided by the Inviting PoC Client. * C= PoC Session Identity. * D= The PoC Group Name. * E=PoC Group Identity. * X= for future use (set to 0). * @param sessionType * Session type indicates the Session Type uri parameter as follows: * 00000000 = no session type * 00000001 = 1-1 * 00000010 = adhoc * 00000011 = prearranged * 00000100 = chat * @param additionalIndications * Additional indications includes the bit pattern axxxxxxx, where each bit indicates if the additional indication is included or * not (1= included, 0=not included) according to the description below: * a= Manual Answer Override Indication. * x= for future use (set to 0). * @param SDESItem * The SDES items and the proper encoding of the URI are specified in [RFC3550]. * @return bytes of TBCPConnect */ public static byte[] createTBCPConnect(long ssrc, byte[] bytesSDESItemContent, byte[] sessionType, byte[] additionalIndications, String... SDESItem) { byte[] bytesSDESItemContentBegin = new byte[8]; byte[] bytesSDESItemContentEnd = new byte[8]; System.arraycopy(bytesSDESItemContent, 0, bytesSDESItemContentBegin, 0, 8); System.arraycopy(bytesSDESItemContent, 8, bytesSDESItemContentEnd, 0, 8); byte[] SDESItemContentBytes = new byte[2]; SDESItemContentBytes[0] = ByteConversion.bitsToByte(bytesSDESItemContentBegin); SDESItemContentBytes[1] = ByteConversion.bitsToByte(bytesSDESItemContentEnd); int count = 0; for (int i = 0; i < bytesSDESItemContent.length; i++) { if (bytesSDESItemContent[i] == 1) { count++; } } int lengthOfSDESItem = 0; for (String s : SDESItem) { lengthOfSDESItem += s.length(); } int length; int sdesItemsLength = (lengthOfSDESItem + 2 * count) % 4; if (sdesItemsLength != 0) { length = 4 + 2 * count + lengthOfSDESItem - sdesItemsLength + 4; } else { length = 4 + 2 * count + lengthOfSDESItem + 4; } byte[] data = new byte[length]; int position = 0; data[0] = SDESItemContentBytes[0]; data[1] = SDESItemContentBytes[1]; data[2] = ByteConversion.bitsToByte(sessionType); data[3] = ByteConversion.bitsToByte(additionalIndications); position += 4; for (String s : SDESItem) { data[position] = 8; data[position + 1] = (byte) s.length(); position += 2; System.arraycopy(s.getBytes(), 0, data, position, s.getBytes().length); position += s.getBytes().length; } byte[] name = POCNAME.getBytes(); return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_CONNECT, name, data); } /** * 构造RTCPAppPacket * @param ssrc * @param type * @param name * @param data * @return bytes of RTCPAppPacket */ public static byte[] prepareRTCPAppPacket(long ssrc, int type, byte[] name, byte[] data){ byte[] rtcpPkt = new byte[1500]; int index = 0; RtcpPktAPP pkt = new RtcpPktAPP(ssrc, type, name, data); pkt.encode(); System.arraycopy(pkt.rawPkt, 0, rtcpPkt, index, pkt.rawPkt.length); index += pkt.rawPkt.length; byte[] output = new byte[index]; System.arraycopy(rtcpPkt, 0, output, 0, index); rtcpPkt = null; StringBuilder sb = new StringBuilder(); for(int i=0;i

 

TBCPMessageParser.java

/** * 文件名: TBCPMessageParser.java */ package tbcpstack; import org.apache.log4j.Logger; import TBCPException; public class TBCPMessageParser { /** * Logger for this class */ private static final Logger logger = Logger.getLogger(TBCPMessageParser.class); /** * 根据收到的byte数组解析成TBCPMessage对象 * @param bytesPkt * @return TBCPMessage对象 * @throws TBCPException 如果不是 */ public static TBCPMessage parse(byte[] bytesPkt) throws TBCPException { RtcpPktAPP rtcpPktAPP = new RtcpPktAPP(bytesPkt, 0); if (rtcpPktAPP != null) { if (rtcpPktAPP.pktName != null) { TBCPMessage tbcpMessage = new TBCPMessage(rtcpPktAPP); if (tbcpMessage.getType() == TBCPMessageType.TBCP_REQUEST || tbcpMessage.getType() == TBCPMessageType.TBCP_RELEASE || tbcpMessage.getType() == TBCPMessageType.TBCP_QUEUE_STATUS_REQUEST || tbcpMessage.getType() == TBCPMessageType.TBCP_TAKEN_WITH_ACK || tbcpMessage.getType() == TBCPMessageType.TBCP_ACK) { return tbcpMessage; } else { logger.error("This is not a TBCP bytes.TBCPMessageParser - parse()"); throw new TBCPException("Cause a TBCPParseException.This is not a TBCP bytes."); } } else { logger.error("rtcpPktAPP.pktName is null.TBCPMessageParser - parse()"); throw new TBCPException("Cause a TBCPParseException.rtcpPktAPP.pktName is null."); } } else { logger.error("rtcpPktAPP is null.TBCPMessageParser - parse()"); throw new TBCPException("Cause a TBCPParseException.rtcpPktAPP is null."); } } }

你可能感兴趣的:(JAVA,java,byte,session,function,server,string)