Correct bug in SIwait causing excessive CPU use
[ric-plt/lib/rmr.git] / src / rmr / si / src / si95 / sistruct.h
1 // vim: noet sw=4 ts=4:
2 /*
3 ==================================================================================
4     Copyright (c) 2020 Nokia
5     Copyright (c) 2020 AT&T Intellectual Property.
6
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
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
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 ==================================================================================
19 */
20
21 /*
22 ***************************************************************************
23 *
24 * Mnemonic: sistruct.h
25 * Abstract: This file contains the structure definitions ncessary to support
26 *           the SI (Socket interface) routines.
27 * Date:     26 March 1995
28 * Author:   E. Scott Daniels
29 *
30 ******************************************************************************
31 */
32
33 struct ioq_blk              //  block to queue on session when i/o waiting 
34 {
35         struct ioq_blk *next;     //  next block in the queue 
36         char *data;               //  pointer to the data buffer 
37         unsigned int dlen;        //  data length 
38         void *addr;               //  address to send to (udp only) 
39         int alen;               //  size of address struct (udp) 
40  };
41
42 struct callback_blk         //  defines a callback routine 
43 {
44         void *cbdata;            //  pointer to be passed to the call back routine 
45         int ((*cbrtn)( ));       //  pointer to the callback routine 
46 };
47
48 struct tp_blk               //  transmission provider info block 
49 {
50         struct tp_blk *next;            //  chain pointer 
51         struct tp_blk *prev;            //  back pointer 
52         int fd;                         //  open file descriptor 
53         int flags;                      //  flags about the session / fd 
54         int type;                       //  connection type SOCK_DGRAM/SOCK_STREAM 
55         int family;                                     //  address family  AF_* constants from system headers
56         struct sockaddr *addr;          //  connection local address 
57         struct sockaddr *paddr;         //  session partner's address 
58         int             palen;                          //      length of the struct referenced by paddr (connect needs)
59         struct ioq_blk *squeue;         //  queue to send to partner when it wont block 
60         struct ioq_blk *sqtail;         //  last in queue to eliminate the need to search 
61
62                                                                 // a few counters for stats
63         long long qcount;                       // number of messages that waited on the queue
64         long long sent;                         // send/receive counts
65         long long rcvd;
66 };
67
68 struct ginfo_blk {                              //  general info block  (context)
69         unsigned int magicnum;          //  magic number that ids a valid block 
70         struct tp_blk *tplist;          //  pointer at tp block list 
71         fd_set readfds;                         //  select/poll file des lists
72         fd_set writefds;
73         fd_set execpfds;
74         char *rbuf;                                     //  read buffer 
75         struct callback_blk *cbtab; //  pointer at the callback table 
76         int fdcount;                            //  largest fd to select on in siwait 
77         int flags;                                      //  status flags 
78         int     tcp_flags;                              // connection/session flags (e.g. no delay)
79         int rbuflen;                            //  read buffer length 
80         int     sierr;                                  // our internal error number (SI_ERR_* constants)
81         struct tp_blk** tp_map;         // direct fd -> tp block map
82 };