WISP ERT (Server)  1.0.0
The WISP Extended Runtime (Server side)
wtp.connection.WTPConnection Class Reference

WTP connection class. More...

Inheritance diagram for wtp.connection.WTPConnection:
wtp.util.EventTarget

Public Member Functions

def __init__ (self, server, wisp_id, checksum_func, checksum_type)
 WTP connection constructor. More...
 
def send (self, msg_data)
 Send a message to WISP. More...
 
def recv (self)
 Receive a message from WISP. More...
 
def close (self)
 Close WTP connection with WISP. More...
 
- Public Member Functions inherited from wtp.util.EventTarget
def __init__ (self)
 Event target mix-in constructor. More...
 
def on (self, event, handler=None)
 Add an event handler. More...
 
def off (self, event, handler)
 Remove an event handler. More...
 
def trigger (self, event, result=None)
 Trigger an event. More...
 

Public Attributes

 server
 WTP server reference. More...
 
 wisp_id
 WISP ID. More...
 
 uplink_state
 Downlink state. More...
 
 downlink_state
 Uplink state. More...
 

Private Member Functions

def _build_header (self, packet_type)
 Build WTP packet header for sending. More...
 
def _build_ack (self)
 Build WTP acknowledgement packet. More...
 
def _handle_packet (self, stream, packet_type)
 Handle WTP packet for current connection. More...
 
def _handle_open (self, stream)
 Handle WTP open packet. More...
 
def _handle_close (self, stream)
 Handle WTP close packet. More...
 
def _handle_ack (self, stream)
 Handle WTP acknowledgement packet. More...
 
def _handle_data_packet (self, stream, msg_begin)
 Handle WTP message data packet. More...
 
def _handle_req_uplink (self, stream)
 Handle WTP request uplink packet. More...
 
def _handle_set_param (self, stream)
 Handle WTP set parameter packet. More...
 
def _request_access_spec (self)
 Request sending AccessSpec to WISP. More...
 

Private Attributes

 _tx_ctrl
 Transmit control. More...
 
 _rx_ctrl
 Receive control. More...
 
 _opspec_ctrl
 OpSpec congestion control. More...
 
 _recv_msgs
 Received messages. More...
 
 _recv_deferreds
 Receive deferreds. More...
 
 _send_deferreds
 Sending deferreds. More...
 
 _read_opspec_sizes
 Sizes of pending Read OpSpecs. More...
 
 _ongoing_access_spec
 Ongoing AccessSpec flag. More...
 

Static Private Attributes

dictionary _pkt_handler
 Packet handlers. More...
 

Detailed Description

WTP connection class.

Constructor & Destructor Documentation

◆ __init__()

def wtp.connection.WTPConnection.__init__ (   self,
  server,
  wisp_id,
  checksum_func,
  checksum_type 
)

WTP connection constructor.

Parameters
serverWTP server reference.
wisp_idWISP ID.
checksum_funcChecksum function.
checksum_typeChecksum data type.

Member Function Documentation

◆ _build_ack()

def wtp.connection.WTPConnection._build_ack (   self)
private

Build WTP acknowledgement packet.

Returns
WTP acknowledgement packet data

◆ _build_header()

def wtp.connection.WTPConnection._build_header (   self,
  packet_type 
)
private

Build WTP packet header for sending.

Parameters
packet_typeWTP packet type.
Returns
Checksum stream containing WTP packet header.

◆ _handle_ack()

def wtp.connection.WTPConnection._handle_ack (   self,
  stream 
)
private

Handle WTP acknowledgement packet.

Parameters
streamData stream containing acknowledgement packet.

◆ _handle_close()

def wtp.connection.WTPConnection._handle_close (   self,
  stream 
)
private

Handle WTP close packet.

Parameters
streamData stream containing close packet.

◆ _handle_data_packet()

def wtp.connection.WTPConnection._handle_data_packet (   self,
  stream,
  msg_begin 
)
private

Handle WTP message data packet.

Parameters
streamData stream containing continue message packet.
msg_beginTrue for WTP_PKT_BEGIN_MSG and False for WTP_PKT_CONT_MSG.

◆ _handle_open()

def wtp.connection.WTPConnection._handle_open (   self,
  stream 
)
private

Handle WTP open packet.

Parameters
streamData stream containing open packet.

◆ _handle_packet()

def wtp.connection.WTPConnection._handle_packet (   self,
  stream,
  packet_type 
)
private

Handle WTP packet for current connection.

Parameters
streamData stream containing WTP packet.
packet_typePacket type.

◆ _handle_req_uplink()

def wtp.connection.WTPConnection._handle_req_uplink (   self,
  stream 
)
private

Handle WTP request uplink packet.

Parameters
streamData stream containing request uplink packet.

◆ _handle_set_param()

def wtp.connection.WTPConnection._handle_set_param (   self,
  stream 
)
private

Handle WTP set parameter packet.

Parameters
streamData stream containing set parameter packet.

◆ _request_access_spec()

def wtp.connection.WTPConnection._request_access_spec (   self)
private

Request sending AccessSpec to WISP.

◆ close()

def wtp.connection.WTPConnection.close (   self)

Close WTP connection with WISP.

◆ recv()

def wtp.connection.WTPConnection.recv (   self)

Receive a message from WISP.

Returns
: A deferred object that will be resolved with received message data.

◆ send()

def wtp.connection.WTPConnection.send (   self,
  msg_data 
)

Send a message to WISP.

Parameters
msg_dataMessage data
Returns
A deferred object that will be resolved when the message is fully sent.

Member Data Documentation

◆ _ongoing_access_spec

wtp.connection.WTPConnection._ongoing_access_spec
private

Ongoing AccessSpec flag.

◆ _opspec_ctrl

wtp.connection.WTPConnection._opspec_ctrl
private

OpSpec congestion control.

◆ _pkt_handler

dictionary wtp.connection.WTPConnection._pkt_handler
staticprivate
Initial value:
= {
consts.WTP_PKT_OPEN: _handle_open,
consts.WTP_PKT_CLOSE: _handle_close,
consts.WTP_PKT_ACK: _handle_ack,
consts.WTP_PKT_BEGIN_MSG: functools.partial(_handle_data_packet, msg_begin=True),
consts.WTP_PKT_CONT_MSG: functools.partial(_handle_data_packet, msg_begin=False),
consts.WTP_PKT_REQ_UPLINK: _handle_req_uplink,
consts.WTP_PKT_SET_PARAM: _handle_set_param
}

Packet handlers.

◆ _read_opspec_sizes

wtp.connection.WTPConnection._read_opspec_sizes
private

Sizes of pending Read OpSpecs.

◆ _recv_deferreds

wtp.connection.WTPConnection._recv_deferreds
private

Receive deferreds.

◆ _recv_msgs

wtp.connection.WTPConnection._recv_msgs
private

Received messages.

◆ _rx_ctrl

wtp.connection.WTPConnection._rx_ctrl
private

Receive control.

◆ _send_deferreds

wtp.connection.WTPConnection._send_deferreds
private

Sending deferreds.

◆ _tx_ctrl

wtp.connection.WTPConnection._tx_ctrl
private

Transmit control.

◆ downlink_state

wtp.connection.WTPConnection.downlink_state

Uplink state.

◆ server

wtp.connection.WTPConnection.server

WTP server reference.

◆ uplink_state

wtp.connection.WTPConnection.uplink_state

Downlink state.

◆ wisp_id

wtp.connection.WTPConnection.wisp_id

WISP ID.


The documentation for this class was generated from the following file: