Protocol

Definition of abstract protocol type.

This module defines the protocol type inherited by all protocol code implementations. Also defined is the stack protocol, which adds push and pop functionality.

class src.protocol.Protocol(own: Node, name: str)

Abstract protocol class for code running on network nodes.

own

node protocol is attached to.

Type:

Node

name

label for protocol instance.

Type:

str

abstract received_message(src: str, msg: Message)

Receive classical message from another node.

class src.protocol.StackProtocol(own: Node, name: str)

Abstract protocol class for protocols in a stack structure.

Adds interfaces for push and pop functions.

own

node protocol is attached to.

Type:

Node

name

label for protocol instance.

Type:

str

upper_protocols

Protocols to pop to.

Type:

List[StackProtocol]

lower_protocols

Protocols to push to.

Type:

List[StackProtocol]

abstract pop(**kwargs)

Method to receive information from protocols lower on stack (abstract).

abstract push(**kwargs)

Method to receive information from protocols higher on stack (abstract).

received_message(src: str, msg: Message)

Method to receive messages from distant nodes.