--:::::::::::::: --per1_.ada --:::::::::::::: ----------------------------------------------------------------------- -- -- DoD Protocols NA-00001-200 80-01002-100(-) -- E-Systems, Inc. August 07, 1985 -- -- PER1_.ADA Author : Jim Baldo -- ----------------------------------------------------------------------- with TCP_GLOBALS; use TCP_GLOBALS; with QUEUES; use QUEUES; with T_TCP_GLOBALS_DATA_STRUCTURES; use T_TCP_GLOBALS_DATA_STRUCTURES; with BUFFER_DATA; use BUFFER_DATA; package TCP_ARRIVES_PERIPHERALS is ---------------------------------------------------------- --This implementation is for use with the Telesoft Ada -- --compiler version 1.5 . -- ---------------------------------------------------------- ------------------------------------------------------------------------------ -- THIS PACKAGE CONTAINS ALL THE PROCEDURES AND FUNCTIONS NECESSARY FOR -- -- PROCESSING ARRIVED SEGMENTS. IT ALSO CONTAINS THE HEADER FORMAT ROUTINE. -- ------------------------------------------------------------------------------ type RES is (GOOD, BAD); --***********************GLOBAL ROUTINES******************************** procedure PROCESS_RESET_IN_DATA_ACCEPTING_STATES( LCN : in TCB_PTR); --This procedure process an arrived reset in the data accepting --states. It basically closes down the connection and clears --the necessary data out of the appropriate queues. procedure SEND_A_RESET( LCN : in TCB_PTR); --This procedure will format and send a reset, for the remote host, to --the ip. procedure FIN_CHECK_FOR_ESTAB_OR_SYN_RECEIVED_STATES ( LCN : in out TCB_PTR; BUFPTR : in out BUFFER_POINTER); --This procedure checks to see if the fin bit is set. If the fin is --set it then puts the TCB in the close-wait state. procedure PROCESS_SEGMENT_TEXT( LCN : in TCB_PTR; BUFPTR : in out BUFFER_POINTER); --This procedure will determine if text exists and if so fill as many --receive buffers as it can and return them to the user. Any data it --can not return it will queue up. procedure PROCESS_URGENT_FLAG( LCN : in TCB_PTR; BUFPTR : in out BUFFER_POINTER); --This procedure checks the urgent bit and if set, it will notify the --user of urgent data (if the urgent pointer is in advance of the data --and the user has not already been notified). procedure PROCESS_A_FIN( LCN : in out TCB_PTR; BUFPTR : in out BUFFER_POINTER); --This procedure will notify the user that the connection is closing, --and return all receives with data if possible. It will also ensure --that an ack was or will be sent for the fin. procedure SEND_A_PIGGYBACKED_ACK( LCN : in out TCB_PTR); --This procedure will send an ack together with data (if available) --to the IP for processing. It will also try to clear the transmit --queue of data. By sending it. It will update everything necessary --in the TCB. procedure SEND_FROM_TRANSMIT_QUEUE( LCN : in out TCB_PTR); --This procedure will send any segments from the transmit queue that --will fit in the window. It will format them for transmission. It --will check upon emptying its queue for the close pending flag and --take appropriate action. function UNPACK( PACKED_BUFFER : in PACKED_BUFFER_PTR; TOTAL_DATA_BYTES : in SIXTEEN_BITS ) return BUFFER_POINTER; --This function will take an array of system.bytes (a bit stream) and --unpack this into an easy to use record. It uses the generic --function unchecked conversion via several functions to move the bits --into the record fields. The system bytes are considered to be --integers. We simply move the proper number of bits into the proper --fields in the record. procedure PROCESS_COMMON_ACK( LCN : in TCB_PTR; BUFPTR : in BUFFER_POINTER; RESULT : out RES); --This procedure does all the processing for an arrived ack in the --established state as per the specification. This processing is --common to the other states also. procedure ENTER_ESTABLISHED_STATE_PROCESSING( LCN : in TCB_PTR; BUFPTR : in out BUFFER_POINTER); --This procedure will perform all the processing of a segment in the --established state, beginning with the check of the urgent flag. --It will also process all the data on the TCP received segment queue. procedure SEND_A_SYN_AND_ACK( LCN : in TCB_PTR); --This procedure will format a segment for a syn and an ack and send it --to the IP bound for the remote host. procedure BAD_SYN_HANDLER( LCN : in TCB_PTR; BUFPTR : in out BUFFER_POINTER); --This procedure checks to make sure that the syn is indeed bad. Then --it sends a reset to the offending host and clears the necessary --queues of entries for this connection. It tells the user that the --connection was reset and closes the connection. procedure SEND_A_RESET_AND_ACK( LCN : in TCB_PTR); --This procedure will format a header for a segment with the reset --and ack control bits set. This will be sent to the IP layer for --transmission to the remote host. -- ******************************************************************* RESULTS : RES; BUFFTYPE : CONSTANT SIXTEEN_BITS := 1; -- ONLY ONE TYPE OF BUFFER FOR NOW. GLOBAL_PACKED_BUFFER : PACKED_BUFFER_PTR; end TCP_ARRIVES_PERIPHERALS;