Server.py – Server

Server class that simualtes a server behaving as defined in the AUTOSAT standard. Each server instance is executed as a single process.

Classes

Server

class Server.Server(config, q, writer, clientQueues, attackers, stopQueue, verbose=False)[source]

Initialization of the server object.

Parameters:
  • config – Own server configuration.
  • q – Own queue for receiving messages from clients.
  • writer – Queue for writing out a packet.
  • clientQueues – Queues of all available clients.
  • attackers – Attacker Queue as the attacker is implemented as MitM.
  • stopQueues – A DONE is sent to this queue if on q a DONE is received.
  • verbose – If set to True, more output is printed, default=False
setName(name)[source]

Setter for the own server name.

Functions

server

Server.server(s)[source]

Main service function that initializes the server object, waits for incomming clients requests and responds to them.

msgTypeSupported

Server.msgTypeSupported(msgType)[source]

Checks whether or not the requested message type is supported.

checkServiceAndMethodKnown

Server.checkServiceAndMethodKnown(service, serviceID, methodID)[source]

Checks whether or not the requested service and method are provided by this instance.

requestedMethodIsRequest

Server.requestedMethodIsRequest(service, serviceID, methodID)[source]

Checks whether or not the requested service and method is of type REQUEST.

generateRandomReply

Server.generateRandomReply(errorRate, verbose, name)[source]

Generates a random reply, with a certain defined probability, otherwise an error is sent back.

sendReply

Server.sendReply(msgType, msgRet, client, reply, timestamp, s)[source]

Putting everything together and send the reply/error.

Parameters:
  • msgType – The used message type for the reply.
  • msgRet – The used return/error code for the reply.
  • client – The client the message is sent to.
  • reply – The content of the reply.
  • timestamp – The timestamp that shall be used.
  • s – Own server instance.