Module Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareEq AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse If CompareEq AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse If CompareEq AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse Raise Call NameLoad Str If UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert CompareEq AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr Num BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert Call NameLoad NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num Assign AttributeStore NameLoad attr Num Return Call AttributeLoad NameLoad attr Num NameLoad orelse Expr Call AttributeLoad NameLoad attr Str Str Assign AttributeStore NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr Num BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert Call NameLoad NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Return Call AttributeLoad NameLoad attr Num orelse Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Str Return Call AttributeLoad NameLoad attr Num BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert CompareEq AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Num BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr If CompareEq NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Str Return Call AttributeLoad NameLoad attr orelse AugAssignAdd AttributeStore NameLoad attr Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert CompareEq AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Num Str If CompareNotEq BinOpAdd AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr If CompareLt Call NameLoad AttributeLoad NameLoad attr Num body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr AugAssignAdd AttributeStore NameLoad attr Num Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd AttributeStore NameLoad attr Num Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr NameLoad decorator_list decorator_list
N/A N/A logging N/A calendar N/A threading N/A time N/A packets response_router WriteBuffer utility lock N/A UNINITIALIZED 0 N/A WRITING 1 N/A READING 2 N/A COMPLETED 3 TFTPConversation N/A object N/A N/A A TFTPConversation represents a single conversation between one client
    and this server. It acts as a state machine that manages the process of
    handling a tftp operation.

    Properties:
        current_block_num: Equivalent to the block number that is attached to
            the packet most recently sent out by the conversation.
        cached_packet: The most recently sent non error packet from this
            conversation. Use for retries.
        time_of_last_interaction: The seconds since epoch of the most recently
            received legal packet. Use for timeouts.
     __init__ N/A N/A self client_host client_port response_router N/A N/A N/A Initializes a TFTPConversation with the given client.

        Args:
            client_host: The ip or hostname of the client.
            client port: The port that the clietn is connecting from
            response_router: A response router to handle reads/writes to the
                tftp server.
         N/A N/A self cached_packet None N/A N/A self client_host client_host N/A N/A self client_port client_port N/A N/A self lock N/A N/A threading Lock N/A N/A self response_router response_router N/A N/A self retries_made 0 N/A N/A self state UNINITIALIZED N/A N/A self time_of_last_interaction N/A N/A calendar timegm N/A N/A time gmtime N/A handle_packet N/A N/A self packet N/A N/A N/A Takes a packet from the client and advances the state machine
        depending on that packet. Resets the time of last interaction and the
        retries made count. Caches the output packet in case it needs to be
        resent, unless the output packet is an ErrorPacket. In that case, it
        maintains whatever previously was in the cache.

        Args:
            packet: A packet object that has already been unpacked.

        Returns:
            a packet object with which to send back to the client. Returns a
            NoOpPacket if the conversation has ended.
         N/A N/A N/A self state UNINITIALIZED N/A N/A output_packet N/A N/A self _handle_initial_packet packet N/A N/A N/A N/A self state READING N/A N/A output_packet N/A N/A self _handle_read_packet packet N/A N/A N/A N/A self state WRITING N/A N/A output_packet N/A N/A self _handle_write_packet packet N/A N/A N/A Exception Illegal State of TFTPConversation N/A N/A N/A isinstance output_packet N/A packets ErrorPacket N/A N/A N/A self cached_packet output_packet N/A N/A N/A self _reset_retry_and_time_data N/A output_packet N/A lock _handle_initial_packet N/A N/A self packet N/A N/A N/A Takes a packet from the client and advances the state machine
        depending on that packet. This should only be invoked from the
        UNINITIALIZED state.

        Args:
            packet: A packet object that has already been unpacked.

        Returns:
            a packet object with which to send back to the client.
         N/A N/A N/A self state UNINITIALIZED N/A N/A isinstance packet N/A packets ReadRequestPacket N/A N/A N/A N/A self _handle_initial_read_packet packet N/A N/A isinstance packet N/A packets WriteRequestPacket N/A N/A N/A N/A self _handle_initial_write_packet packet N/A N/A N/A self state COMPLETED N/A N/A N/A packets ErrorPacket 5 N/A Unknown transfer tid.Host: %s, Port: %s N/A N/A self client_host N/A self client_port N/A _handle_initial_read_packet N/A N/A self packet N/A N/A N/A Check if there is an application action to respond to this
        request If so, then send the first block and move the state to
        READING. Otherwise, send back an error packet and move the state
        to COMPLETED.

        Args:
            packet: An unpacked ReadRequestPacket.

        Returns:
            A Data packet if the request's filename matches any possible read
            rule. The data packet includes the first block of data from the
            output of the read action. Otherwise, an ErrorPacket with a file
            not found error code and message.
         N/A N/A isinstance packet N/A packets ReadRequestPacket N/A N/A self filename N/A packet filename N/A N/A self mode N/A packet mode N/A N/A self read_buffer N/A N/A N/A self response_router initialize_read N/A self filename N/A self client_host N/A self client_port N/A N/A self read_buffer N/A N/A N/A self state READING N/A data N/A N/A N/A self read_buffer get_block 1 N/A N/A self current_block_num 1 N/A N/A N/A packets DataPacket 1 data N/A N/A N/A N/A self log READREQUEST File not found N/A N/A self state COMPLETED N/A N/A N/A packets ErrorPacket 1 N/A File not found. Host: %s, Port: %s N/A N/A self client_host N/A self client_port N/A _handle_initial_write_packet N/A N/A self packet N/A N/A N/A  Check if there is an application action to receive this message.
        If so, then send an acknowledgement and move the state to WRITING.
        Otherwise, send back an error packet and move the state to COMPLETED.

        Args:
            packet: An unpacked WriteRequestPacket.

        Returns:
            An Acknowledgement packet if the request's filename matches any
            possible write rule. Otherwise, an ErrorPacket with an access
            violation code and message.
         N/A N/A isinstance packet N/A packets WriteRequestPacket N/A N/A self filename N/A packet filename N/A N/A self mode N/A packet mode N/A N/A self current_block_num 0 N/A N/A self write_action N/A N/A N/A self response_router initialize_write N/A self filename N/A self client_host N/A self client_port N/A N/A self write_action N/A N/A N/A self state WRITING N/A N/A self write_buffer N/A WriteBuffer N/A N/A N/A packets AcknowledgementPacket 0 N/A N/A N/A self state COMPLETED N/A N/A N/A self log WRITEREQUEST Access Violation N/A N/A N/A packets ErrorPacket 2 N/A Access Violation. Host: %s, Port: %s N/A N/A self client_host N/A self client_port N/A _handle_read_packet N/A N/A self packet N/A N/A N/A Takes a packet from the client and advances the state machine
        depending on that packet. This should only be invoked from the READING
        state. Returns an appropriate DataPacket containing the next block of
        data.

        Args:
            packet: A packet object that has already been unpacked.

        Returns:
            a packet object with which to send back to the client.
         N/A N/A N/A self state READING N/A N/A N/A isinstance packet N/A packets AcknowledgementPacket N/A N/A N/A N/A packets ErrorPacket 0 N/A Illegal packet type given current state of conversation.  Host: %s, Port: %s. N/A N/A self client_host N/A self client_port N/A N/A N/A self current_block_num N/A packet block_num N/A N/A N/A N/A packets NoOpPacket N/A previous_block_num N/A packet block_num N/A N/A previous_block_num N/A N/A N/A self read_buffer get_block_count N/A N/A N/A self state COMPLETED N/A N/A N/A self log READREQUEST Success N/A N/A N/A packets NoOpPacket N/A N/A N/A self current_block_num 1 N/A data N/A N/A N/A self read_buffer get_block N/A self current_block_num N/A N/A N/A packets DataPacket N/A self current_block_num data N/A _handle_write_packet N/A N/A self packet N/A N/A N/A Takes a packet from the client and advances the state machine
        depending on that packet. This should only be invoked from the WRITING
        state. If given the last packet in a data transfer (bytes of data is
        less than 512), then invokes the application level action with all of
        the data from the conversation.

        Args:
            packet: A packet object that has already been unpacked.

        Returns:
            An appropriate AcknowledgementPacket containing a matching block
            number.
         N/A N/A N/A self state WRITING N/A N/A N/A isinstance packet N/A packets DataPacket N/A N/A N/A N/A packets ErrorPacket 0 Illegal packet type given current state of conversation N/A N/A N/A N/A self current_block_num 1 N/A packet block_num N/A N/A N/A N/A packets NoOpPacket N/A block_num N/A packet block_num N/A N/A N/A N/A self write_buffer receive_data N/A packet data N/A N/A N/A len N/A packet data 512 N/A N/A N/A self state COMPLETED N/A N/A N/A self log WRITEREQUEST Success N/A N/A N/A self write_action N/A self client_host N/A self client_port N/A self filename N/A N/A self write_buffer data N/A N/A self current_block_num 1 N/A N/A N/A packets AcknowledgementPacket block_num N/A _reset_retry_and_time_data N/A N/A self new_time_of_last_interaction N/A None N/A N/A Resets the time since last interaction to the new time and sets the
        retries made count to 0.

        Args:
            new_time_of_last_interaction: The time to set the
                time_since_last_interaction to (seconds since epoch). If None
                passed, then use the current time since epoch.
         N/A N/A N/A self _update_time_of_last_interaction new_time_of_last_interaction N/A N/A self retries_made 0 N/A mark_retry N/A N/A self new_time_of_last_interaction N/A None N/A N/A Increases the stored count of sending attempts made with the most
        recent outward packet.

        Returns:
            The packet to send out.
         N/A N/A N/A self _update_time_of_last_interaction new_time_of_last_interaction N/A N/A self retries_made 1 N/A N/A self cached_packet N/A lock _update_time_of_last_interaction N/A N/A self new_time_of_last_interaction N/A None N/A N/A Sets the time of the last interaction for this conversation.

        Args:
            new_time_of_last_interaction: An integer representing seconds since
            epoch to be used as the new time_of_last_intersection. If None is
            passed, uses the current amount of seconds since epoch.
         N/A N/A new_time_of_last_interaction N/A N/A new_time_of_last_interaction N/A N/A calendar timegm N/A N/A time gmtime N/A N/A self time_of_last_interaction new_time_of_last_interaction N/A log N/A N/A self request_type comment N/A N/A N/A N/A N/A logging info N/A %s:%s - %s - %s - %s N/A N/A self client_host N/A self client_port request_type N/A self filename comment N/A N/A