<--previous | contents | next-->

# Protocol class

Each protocol in the protocol stack is an instance of a class derived from the Protocol class. In addition to the standard interface documented below, each descendant of the Protocol class typically makes available a myriad of properties and methods for querying and manipulating a specific protocol. For example, one class derived from Protocol is the TCP class, which exposes a property srcPort.

## Interface

### Protocol()

The Protocol class and its decendants should not be instantiated by the user.

### __repr__()

Return a human-readable representation of the protocol.

### __getitem__(protocol)

Case-insensitive retrieval of protocols from the protocol stack by name. See the Packet class documentation for more information.

### has_key(protocol)

Case-insensitive name-based check for the existence of a given protocol within this protocol.

<--previous | contents | next--> | (12/21/04)

PyOpenbsd v0.1 Manual