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 ******************************************************************************
25 * Abstract: This routine will get the address of the first listening
26 * block on the tp list and return it in ASCII format to the
28 * Parms: gptr - Pointer to the global information block
29 * buf - Pointer to the buffer to hold the ascii string
30 * Returns: NI_OK if block found, NI_ERROR if no listen block exists
32 * Author: E. Scott Daniels
34 ******************************************************************************
36 #include "sisetup.h" // get the standard include stuff
38 extern int SIgetaddr( struct ginfo_blk *gptr, char *buf ) {
39 struct tp_blk *tpptr; // Pointer into tp list
40 int status = SI_ERROR; // return status
41 char *ibuf; // SIaddr now points us at a string, rather than filling ours
43 for( tpptr = gptr->tplist; tpptr != NULL && !(tpptr->flags & TPF_LISTENFD);
44 tpptr = tpptr->next );
48 SIaddress( tpptr->addr, (void *) &ibuf, AC_TODOT ); // convert to dot fmt
49 strcpy( buf, ibuf ); // copy into caller's buffer
51 status = SI_OK; // ok status for return