Esempio n. 1
0
    def parseConferenceCreateResponse(
            self, stream: BytesIO) -> GCCConferenceCreateResponsePDU:
        """
        Parse ConferenceCreateResponse data into a GCCPDU
        :param stream: byte stream containing the PDU data
        """

        nodeID = Uint16BE.unpack(stream.read(2)) + 1001
        tag = per.readInteger(stream)
        result = per.readEnumeration(stream)

        userDataCount = per.readNumberOfSet(stream)
        if userDataCount != 1:
            raise ParsingError("Expected user data count to be 1, got %d" %
                               userDataCount)

        userDataType = per.readChoice(stream)
        if userDataType != 0xc0:
            raise ParsingError(
                "Expected user data type to be 0xc0 (h221NonStandard), got %d"
                % userDataType)

        key = per.readOctetStream(stream, 4)
        if key != GCCParser.H221_SERVER_KEY:
            raise ParsingError("Expected user data key to be %s, got %s" %
                               (GCCParser.H221_SERVER_KEY, key))

        payload = per.readOctetStream(stream)
        return GCCConferenceCreateResponsePDU(nodeID, tag, result, payload)
Esempio n. 2
0
    def parseErectDomainRequest(self, stream: BytesIO) -> MCSErectDomainRequestPDU:
        """
        Parse an Erect Domain Request PDU
        :param stream: stream containing the data
        """
        subHeight = 1
        subInterval = 1

        try:
            # Windows generally does not seem to care about invalid erect domain requests, so use default values if
            # parsing fails.
            subHeight = per.readInteger(stream)
            subInterval = per.readInteger(stream)
        except ValueError:
            pass

        payload = stream.read()
        return MCSErectDomainRequestPDU(subHeight, subInterval, payload)