Connectors are a way of have a very generic socket like mechanism over which the packets can be sent. Unlike the current split between sockets, which work OK down to almost the RAW layer, and low level stuff like pcap and bpf, connectors will are a unifying mechanism so you can write packets over any of the available APIs and the connector will do the right thing. The Connector class is a virtual base class upon which all the real classes are based.
Read from the Connector and return the index of the first pattern which matches the input chain; otherwise, raise an exception. On return, the matches property will contain a list of matching packet chain(s). There may be more than one match if a live capture matches more than one before the loop exits. * If the 'limit' argument is set, raise an exception after 'limit' packets have been read, regardless of match. * If 'timeout' is set, raise an exception after the timeout expires. This is only supported if the underlying Connector fully implements non-blocking I/O. The syntax is intentionally similar to that of pexpect: * If any of EOF, LIMIT or TIMEOUT are specified, the exceptions are not raised but are instead matched as patterns. * If a Chain is specified, it is matched against the chain using the Chain.match() method. * If neither a timeout or a limit is specified, or an EOF was not encountered, this function may potentially block forever. * NOTE: Packets can no longer be specified on their own as filters. TODO: Make this drift and jitter robust (CLOCK_MONOTONIC).
Read the next available packet and attempt to decapsulate all available layers of encapsulation into Python objects. If the underlying packet parsers throw an exception, it will propagate here.
Read a packet from the underlying I/O layer, and return an instance of a class derived from pcs.Packet appropriate to the data-link or transport layer in use. If the Connector has multiple data-link layer support, then the type returned by this method may vary. If the underlying packet parsers throw an exception, it will propagate here.
Try to read at most n packet chains from the underlying I/O layer. If n is None or 0, try to read exactly one packet. Connectors with their own buffering semantics should override this method (e.g. PcapConnector). Used by expect().
Referenced by pcs.Connector.expect().