cobbler_tftp.server package

Submodules

cobbler_tftp.server.tftp module

This module contains the main TFTP server class.

class cobbler_tftp.server.tftp.CobblerRequestHandler(server_addr: Tuple[str, int], peer: Tuple[str, int], path: str, options: Dict[str, Any], api: ServerProxy, token: str, settings: Settings)

Bases: BaseHandler

Handles TFTP requests using the Cobbler API.

get_response_data()

This method has to be overridden and must return an object of type ResponseData.

class cobbler_tftp.server.tftp.CobblerResponseData(api: ServerProxy, token: str, path: str, prefetch_size: int)

Bases: ResponseData

File-like object representing the response from the TFTP server. Data is fetched from the API in chunks. These chunks may be larger than the TFTP request chunks, so the returned chunks are cached.

close()
load() None
read(n: int) bytes
size() int
class cobbler_tftp.server.tftp.FileResponseData(path: Path)

Bases: ResponseData

Object representing a static file response from the TFTP server.

close()
read(n: int) bytes
size() int
class cobbler_tftp.server.tftp.TFTPServer(settings: Settings)

Bases: BaseServer

Implements a TFTP server for the Cobbler API using the CobblerRequestHandler.

cleanup()
get_handler(server_addr: Tuple[str, int], peer: Tuple[str, int], path: str, options: Dict[str, Any])

Returns an instance of BaseHandler.

Note:

This is a virtual method and must be overridden in a sub-class. This method must return an instance of BaseHandler.

Args:
server_addr (tuple): tuple containing ip of the server and

listening port.

peer (tuple): tuple containing ip and port of the client.

path (string): the file path requested by the client

options (dict): a dictionary containing the options the clients

wants to negotiate.

Example of options:
  • mode (string): can be netascii or octet. See RFC 1350.

  • retries (int)

  • timeout (int)

  • tsize (int): transfer size option. See RFC 1784.

  • blksize: size of blocks. See RFC 1783 and RFC 2349.

cobbler_tftp.server.tftp.handler_stats_cb(stats: SessionStats)
cobbler_tftp.server.tftp.server_stats_cb(stats: ServerStats)

Called by the fbtftp to log server stats. Currently unused.

Module contents

This package contains the actual TFTP server.

cobbler_tftp.server.run_server(application_settings: Settings)

Set up logging, initialize the server and run it.