Lines Matching refs:suboption
348 def checkAnswer(self, suboption): argument
353 if self.value == suboption[:len(self.value)]:
359 … self.connection.logger.debug("SB Answer %s -> %r -> %s" % (self.name, suboption, self.state))
687 suboption = None
710 if suboption is not None:
711 suboption.append(byte)
718 if suboption is not None:
719 suboption.append(IAC)
725 suboption = bytearray()
729 self._telnetProcessSubnegotiation(bytes(suboption))
730 suboption = None
776 def _telnetProcessSubnegotiation(self, suboption): argument
778 if suboption[0:1] == COM_PORT_OPTION:
779 if suboption[1:2] == SERVER_NOTIFY_LINESTATE and len(suboption) >= 3:
780 self._linestate = ord(suboption[2:3]) # ensure it is a number
783 elif suboption[1:2] == SERVER_NOTIFY_MODEMSTATE and len(suboption) >= 3:
784 self._modemstate = ord(suboption[2:3]) # ensure it is a number
789 elif suboption[1:2] == FLOWCONTROL_SUSPEND:
791 elif suboption[1:2] == FLOWCONTROL_RESUME:
795 if item.ack_option == suboption[1:2]:
797 item.checkAnswer(bytes(suboption[2:]))
801 self.logger.warning("ignoring COM_PORT_OPTION: %r" % (suboption,))
804 self.logger.warning("ignoring subnegotiation: %r" % (suboption,))
917 self.suboption = None
1050 if self.suboption is not None:
1051 self.suboption.append(byte)
1058 if self.suboption is not None:
1059 self.suboption.append(byte)
1065 self.suboption = bytearray()
1069 self._telnetProcessSubnegotiation(bytes(self.suboption))
1070 self.suboption = None
1112 def _telnetProcessSubnegotiation(self, suboption): argument
1114 if suboption[0:1] == COM_PORT_OPTION:
1116 self.logger.debug('received COM_PORT_OPTION: %r' % (suboption,))
1117 if suboption[1:2] == SET_BAUDRATE:
1120 (baudrate,) = struct.unpack("!I", suboption[2:6])
1131 elif suboption[1:2] == SET_DATASIZE:
1134 (datasize,) = struct.unpack("!B", suboption[2:3])
1145 elif suboption[1:2] == SET_PARITY:
1148 parity = struct.unpack("!B", suboption[2:3])[0]
1162 elif suboption[1:2] == SET_STOPSIZE:
1165 stopbits = struct.unpack("!B", suboption[2:3])[0]
1179 elif suboption[1:2] == SET_CONTROL:
1180 if suboption[2:3] == SET_CONTROL_REQ_FLOW_SETTING:
1187 elif suboption[2:3] == SET_CONTROL_USE_NO_FLOW_CONTROL:
1193 elif suboption[2:3] == SET_CONTROL_USE_SW_FLOW_CONTROL:
1198 elif suboption[2:3] == SET_CONTROL_USE_HW_FLOW_CONTROL:
1203 elif suboption[2:3] == SET_CONTROL_REQ_BREAK_STATE:
1207 elif suboption[2:3] == SET_CONTROL_BREAK_ON:
1212 elif suboption[2:3] == SET_CONTROL_BREAK_OFF:
1217 elif suboption[2:3] == SET_CONTROL_REQ_DTR:
1221 elif suboption[2:3] == SET_CONTROL_DTR_ON:
1226 elif suboption[2:3] == SET_CONTROL_DTR_OFF:
1231 elif suboption[2:3] == SET_CONTROL_REQ_RTS:
1236 elif suboption[2:3] == SET_CONTROL_RTS_ON:
1241 elif suboption[2:3] == SET_CONTROL_RTS_OFF:
1253 elif suboption[1:2] == NOTIFY_LINESTATE:
1259 elif suboption[1:2] == NOTIFY_MODEMSTATE:
1264 elif suboption[1:2] == FLOWCONTROL_SUSPEND:
1268 elif suboption[1:2] == FLOWCONTROL_RESUME:
1272 elif suboption[1:2] == SET_LINESTATE_MASK:
1273 self.linstate_mask = ord(suboption[2:3]) # ensure it is a number
1276 elif suboption[1:2] == SET_MODEMSTATE_MASK:
1277 self.modemstate_mask = ord(suboption[2:3]) # ensure it is a number
1280 elif suboption[1:2] == PURGE_DATA:
1281 if suboption[2:3] == PURGE_RECEIVE_BUFFER:
1286 elif suboption[2:3] == PURGE_TRANSMIT_BUFFER:
1291 elif suboption[2:3] == PURGE_BOTH_BUFFERS:
1299 self.logger.error("undefined PURGE_DATA: %r" % list(suboption[2:]))
1302 self.logger.error("undefined COM_PORT_OPTION: %r" % list(suboption[1:]))
1305 self.logger.warning("unknown subnegotiation: %r" % (suboption,))