The Assimilation Project  based on Assimilation version 1.1.7.1474836767
cma.packetlistener.PacketListener Class Reference
Inheritance diagram for cma.packetlistener.PacketListener:
Collaboration diagram for cma.packetlistener.PacketListener:

Public Member Functions

def __init__ (self, config, dispatch, io=None, encryption_required=True)
 
def enqueue_frameset (self, frameset, fromaddr)
 
def dequeue_a_frameset (self)
 
def listen (self)
 
def OLDlisten (self)
 
def listenonce (self)
 
def queueanddispatch (self)
 

Static Public Member Functions

def frameset_prio (frameset)
 
def process_pkt_exception (e)
 
def mainloop_callback (unusedsource, cb_condition, listener)
 

Data Fields

 config
 
 encryption_required
 
 io
 
 dispatcher
 
 iowatch
 
 mainloop
 
 prio_queues
 
 queue_addrs
 

Static Public Attributes

int PRIO_ZERO = 0
 
int PRIO_ONE = 1
 
int PRIO_TWO = 2
 
int PRIO_THREE = 3
 
 DEFAULT_PRIO = PRIO_THREE
 
 LOWEST_PRIO = PRIO_THREE
 
dictionary prio_map
 
dictionary unencrypted_fstypes
 

Detailed Description

Definition at line 48 of file packetlistener.py.

Constructor & Destructor Documentation

def cma.packetlistener.PacketListener.__init__ (   self,
  config,
  dispatch,
  io = None,
  encryption_required = True 
)

Definition at line 80 of file packetlistener.py.

Member Function Documentation

def cma.packetlistener.PacketListener.dequeue_a_frameset (   self)
Read a frameset from our frameset queue system in priority order
We read from the highest priority queues first, moving down the
priority scheme if there are no higher priority queues with packets to read.

Definition at line 145 of file packetlistener.py.

References cma.packetlistener.PacketListener.frameset_prio(), cma.packetlistener.PacketListener.prio_queues, and cma.packetlistener.PacketListener.queue_addrs.

Referenced by cma.packetlistener.PacketListener.queueanddispatch().

Here is the call graph for this function:

Here is the caller graph for this function:

def cma.packetlistener.PacketListener.enqueue_frameset (   self,
  frameset,
  fromaddr 
)
Enqueue (read in) a frameset to our frameset queue system
This queue system has a queue of frameset queues - one per priority level
Each frameset queue consists of three elements:
    'addr'  the IP address of the far-end
    'Q'     a queue of framesets from address 'addr'
    'prio'  the priority of the highest priority packet in the queue
Every frameset in a given frameset queue came from the same address...

When we read in a new packet, we append it to the appropriate frameset
queue - creating it if need be.  If the new packet raises the priority
of the queue, then we move that frameset queue to the appropriate priority queue

We keep a separate hash table (queue_addrs) which associates frameset queues with
the corresponding IP addresses.

Definition at line 112 of file packetlistener.py.

References cma.packetlistener.PacketListener.frameset_prio(), cma.packetlistener.PacketListener.prio_queues, and cma.packetlistener.PacketListener.queue_addrs.

Referenced by cma.packetlistener.PacketListener.listenonce().

Here is the call graph for this function:

Here is the caller graph for this function:

def cma.packetlistener.PacketListener.frameset_prio (   frameset)
static

Definition at line 107 of file packetlistener.py.

Referenced by cma.packetlistener.PacketListener.dequeue_a_frameset(), and cma.packetlistener.PacketListener.enqueue_frameset().

Here is the caller graph for this function:

def cma.packetlistener.PacketListener.listen (   self)
def cma.packetlistener.PacketListener.listenonce (   self)

Definition at line 243 of file packetlistener.py.

References cma.packetlistener.PacketListener.enqueue_frameset().

Referenced by cma.packetlistener.PacketListener.OLDlisten().

Here is the call graph for this function:

Here is the caller graph for this function:

def cma.packetlistener.PacketListener.mainloop_callback (   unusedsource,
  cb_condition,
  listener 
)
static

Definition at line 193 of file packetlistener.py.

def cma.packetlistener.PacketListener.OLDlisten (   self)

Definition at line 237 of file packetlistener.py.

References cma.packetlistener.PacketListener.listenonce().

Here is the call graph for this function:

def cma.packetlistener.PacketListener.process_pkt_exception (   e)
static
Handle an unexpected exception.
Under us, the MessageDispatcher code will catch *most* exceptions.
But those that result from badly formatted/encrypted messages
that keep us from understanding or trusting the message
will get caught here.

Definition at line 174 of file packetlistener.py.

def cma.packetlistener.PacketListener.queueanddispatch (   self)

Field Documentation

cma.packetlistener.PacketListener.DEFAULT_PRIO = PRIO_THREE
static

Definition at line 55 of file packetlistener.py.

cma.packetlistener.PacketListener.dispatcher

Definition at line 96 of file packetlistener.py.

cma.packetlistener.PacketListener.encryption_required
cma.packetlistener.PacketListener.io

Definition at line 84 of file packetlistener.py.

cma.packetlistener.PacketListener.iowatch

Definition at line 97 of file packetlistener.py.

Referenced by cma.packetlistener.PacketListener.listen().

cma.packetlistener.PacketListener.LOWEST_PRIO = PRIO_THREE
static

Definition at line 56 of file packetlistener.py.

cma.packetlistener.PacketListener.mainloop

Definition at line 98 of file packetlistener.py.

Referenced by cma.packetlistener.PacketListener.listen().

dictionary cma.packetlistener.PacketListener.prio_map
static
Initial value:
1 = { # Our map of packet type priorities
2  FrameSetTypes.CONNSHUT: PRIO_ZERO, # High priority and cheap
3  FrameSetTypes.HBSHUTDOWN: PRIO_ZERO,
4  FrameSetTypes.HBDEAD: PRIO_ZERO,
5  FrameSetTypes.PING: PRIO_ZERO,
6  FrameSetTypes.PONG: PRIO_ZERO,
7  FrameSetTypes.RSCOPREPLY: PRIO_ZERO,
8 
9  FrameSetTypes.STARTUP: PRIO_ONE, # High priority but sometimes expensive
10 
11  FrameSetTypes.SWDISCOVER: PRIO_TWO, # Not priority, often expensive
12  FrameSetTypes.JSDISCOVERY: PRIO_TWO,
13 
14  FrameSetTypes.HBLATE: PRIO_THREE, # Not terribly important
15  FrameSetTypes.HBBACKALIVE: PRIO_THREE,
16  FrameSetTypes.HBMARTIAN: PRIO_THREE,
17  }

Definition at line 58 of file packetlistener.py.

int cma.packetlistener.PacketListener.PRIO_ONE = 1
static

Definition at line 51 of file packetlistener.py.

cma.packetlistener.PacketListener.prio_queues
int cma.packetlistener.PacketListener.PRIO_THREE = 3
static

Definition at line 53 of file packetlistener.py.

int cma.packetlistener.PacketListener.PRIO_TWO = 2
static

Definition at line 52 of file packetlistener.py.

int cma.packetlistener.PacketListener.PRIO_ZERO = 0
static

Definition at line 50 of file packetlistener.py.

cma.packetlistener.PacketListener.queue_addrs
dictionary cma.packetlistener.PacketListener.unencrypted_fstypes
static
Initial value:
1 = {
2  FrameSetTypes.STARTUP
3  }

Definition at line 76 of file packetlistener.py.


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