The following diagram shows the symbol which represents the TCP layer of the Bluetooth stack, as created in VCC. The ports on the top side of the diagram show the interface to the layer above TCP, which in the scope of this project is the user application, and the ports on the lower side show the interface from TCP to the lower, 'Gateway', level protocol, which in the case of this project is IP.
The following ports are provided for the application to interface with TCP:
These implement the standard upper-interface of TCP in the following way:
Direction: Input.
Arguments: TCP_Open_args
Operation: The application uses this port to open a connection from a local port, to a foreign socket, both of which are specified in the arguments passed to the port. In addition to this, an active/passive flag is passed in the arguments. This indicates to the TCP block whether it should actively try to open a connection with the specified remote system, or whether it should just passively listen for incoming connections from the remote system.
Direction: Output.
Arguments: vcc_string: local_connection_name
Operation: This output port is used to report the success or failure to open a connection corresponding to the activation of the 'Open' port by the application. If a connection was successfully opened, a string containing the name given to the connection by TCP is returned. This string is then used by the application when it wishes to perform any operations with this connection.
Direction: Input.
Arguments: TCP_Send_args
Operation: This port is used by the application to send the contents of the buffer in the arguments to the TCP block on the other end of the named connection. The 'byte_count' field in the arguments is used to tell TCP the exact number of octets in the buffer which should be sent (since the message to be sent may not totally fill the buffer.)
Direction: Output.
Arguments: TCP_Receive_args
Operation: Not used currently. According to the standard, the application should have to explicitly make a call to TCP to receive any data, hence why this port was put into the diagram. However, it was decided that simply giving data to the application as soon as the data was ready would make the protocol stack easier for the application designers to use, and, due to VCC's event driven nature, was still in-keeping with the spirit of the method described in the standard.
Direction: Output.
Arguments: TCP_Receive_results
Operation: A TCP_Receive_Result structure is passes through this port when TCP is ready to send some data to the application (either when an entire message has been received and collated or when a packet arrives with its PUSH flag set.
Direction: Input.
Arguments: vcc_string: local_connection_name.
Operation: This port allows the application to request certain status information about the named connection. The results of this request are passed back to the application via the 'Status_Results' port.
Direction: Output.
Arguments: TCP_Status_Result
Operation: This port is activated in response to the application requesting status information on the connection via the 'Status' port. The information returned is as follows:
Direction: Input.
Arguments: vcc_string: local_connection_name
Operation: Activation of this port causes all pending 'Send's' and 'Receive's' to be canceled, and a 'RESET' message to be sent to the TCP block on the other side of the connection.
Direction: Input.
Arguments: vcc_string: local_connection_name
Operation: Activation of this port causes the named connection to be closed, and the TCP blocks on either side of the connection to return to the status of listening for connections. Once the application has 'closed' the connection it is still possible for it to receive data from the other end of the connection which was sent before the other side received the close request.
Direction: Output.
Arguments: TCP_Packet
Operation: This port can be used to send a TCP_Packet to the IP layer of the stack.
Direction: Input.
Arguments: TCP_Packet
Operation: This port is used to receive TCP_Packets which are being sent up from the IP layer.
Direction: Input.
Arguments: Integer
Operation: Used by IP to inform TCP that it is now free to send packets to IP.