1 // vim: noet sw=4 ts=4:
3 ==================================================================================
4 Copyright (c) 2020 Nokia
5 Copyright (c) 2020 AT&T Intellectual Property.
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ==================================================================================
22 **************************************************************************
24 * Abstract: This routine will terminate a session based on the tp_blk
25 * that is passed into the routine. The transport session block
26 * is released and removed from the ginfo list. The session is
27 * terminated by issuing a t_unbind call (if the unbind flag is
28 * on in the tpptr block), and then issuing a t_close.
29 * Parms: gptr - Pointer to the global information block
30 * tpptr - Pointer to tp block that defines the open fd.
32 * Date: 18 January 1995
33 * Author: E. Scott Daniels
35 **************************************************************************
37 #include "sisetup.h" // get the setup stuff
38 #include "sitransport.h"
40 extern void SIterm( struct ginfo_blk* gptr, struct tp_blk *tpptr ) {
43 if( tpptr->fd >= 0 ) {
45 if( tpptr->fd < MAX_FDS ) {
46 gptr->tp_map[tpptr->fd] = NULL; // drop reference
50 if( tpptr->prev != NULL ) { // remove from the list
51 tpptr->prev->next = tpptr->next; // point previous at the next
53 gptr->tplist = tpptr->next; // this was head, make next new head
56 if( tpptr->next != NULL ) {
57 tpptr->next->prev = tpptr->prev; // point next one back behind this one
60 free( tpptr->addr ); // release the address bufers
62 free( tpptr ); // and release the block