Coda Distributed File System
rescomm.h
Go to the documentation of this file.
1/* BLURB gpl
2
3 Coda File System
4 Release 6
5
6 Copyright (c) 1987-2003 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU General Public Licence Version 2, as shown in the
11file LICENSE. The technical and financial contributors to Coda are
12listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19/* rescomm.h
20 * Communication management for resolution subsystem
21 * Created Puneet Kumar, June 1990
22 */
23#ifndef _RES_COMM_H_
24#define _RES_COMM_H_ 1
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <rpc2/rpc2.h>
31
32#ifdef __cplusplus
33}
34#endif
35
36#include <olist.h>
37#include <dlist.h>
38#include <vice.h>
39#include <res.h>
40#include <vcrcommon.h>
41#include "resutil.h"
42#include "resolution.h"
43
44#include "deprecations.h"
45
46/* forward declarations */
47class res_mgrpent;
48class srvent;
49class srv_iterator;
50class RepResCommCtxt;
52class conninfo;
54class pdlist;
55class VNResLog;
56class rlent;
57
58extern int GetResMgroup(res_mgrpent **, unsigned long hosts[VSG_MEMBERS]);
59extern int PutResMgroup(res_mgrpent **);
60extern void ResCommInit();
61extern srvent *FindServer(unsigned long);
62extern void GetServer(srvent **, unsigned long);
63extern void PutServer(srvent **);
64extern void ServerPrint(int);
65extern void ServerPrint();
66extern void ServerPrint(FILE *);
67extern void ResMgrpPrint(int);
68extern void ResMgrpPrint();
69extern void ResMgrpPrint(FILE *);
70extern long ViceResolve(RPC2_Handle, ViceFid *);
72
73class srvent {
74 friend void ResCommInit();
75 friend srvent *FindServer(unsigned long);
76 friend void GetServer(srvent **, unsigned long);
77 friend void ServerPrint(int);
78 friend class srv_iterator;
79 friend void ResCheckServerLWP_worker(void *);
80 /* The server list. */
81 static olist *srvtab;
82
83 /* Other shared data. */
84 static int servers;
85
86 /* Transient members. */
87 olink tblhandle;
88 char *name;
89 unsigned long host;
90 unsigned binding : 1; /* 1 --> BINDING, 0 --> NOT_BINDING */
91 enum state
92 {
93 up,
94 down,
95 unknown
96 } srvrstate;
97
98 /* Constructors, destructors, and private utility routines. */
99 srvent(unsigned long);
100 ~srvent();
101
102public:
103 int Connect(RPC2_Handle *, int);
104 void Reset();
105 int ServerIsDown();
106 int ServerIsUp();
107 void ServerError(int *);
108 void print();
109 void print(FILE *);
110 void print(int);
111};
112
114public:
115 srv_iterator();
117};
118
120public:
122 RPC2_Handle handles[VSG_MEMBERS];
123 unsigned long hosts[VSG_MEMBERS];
124 RPC2_Integer retcodes[VSG_MEMBERS];
125 unsigned long primaryhost;
127 unsigned dying[VSG_MEMBERS];
128
131
132 void print();
133 void print(FILE *);
134 void print(int);
135};
136
138public:
139 /* the mgrp list */
141
142 /* shared data */
143 static int resmgrps;
144
145 /* transient members */
147
148 /* Static state; immutable after construction */
150 unsigned long Hosts[VSG_MEMBERS]; /* All VSG hosts in canonical order */
151
152 /* Dynamic state */
153 unsigned inuse : 1;
154 unsigned dying : 1;
156
157 /* Constructors, Destructors */
158 res_mgrpent(unsigned long hosts[VSG_MEMBERS], RPC2_Handle);
159 ~res_mgrpent();
160
161 int CreateMember(unsigned long);
162 void KillMember(unsigned long, int);
163 int GetHostSet(unsigned long *);
164 void PutHostSet();
165 int CheckResult();
166 int IncompleteVSG();
167 void print();
168 void print(FILE *);
169 void print(int);
170};
171
172static unsigned long ALL_VSGS[VSG_MEMBERS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
174 unsigned long Hosts[VSG_MEMBERS];
175 int allhosts;
176
177public:
178 resmgrp_iterator(unsigned long hosts[VSG_MEMBERS] = ALL_VSGS);
180};
181
182class conninfo {
183 friend class conninfo_iterator;
184 friend void srvent::Reset();
185 friend void ResCommInit();
188 /* globals state */
189 static olist *CInfoTab;
190 static int ncinfos;
191
192 olink tblhandle;
193 /* immutable info once created */
194 unsigned long RemoteAddr;
195 unsigned short RemotePortNum;
196 int SecLevel;
197 RPC2_Handle cid;
198
199 /* constructors and destructors */
200 conninfo(RPC2_Handle, int);
201 ~conninfo();
202
203public:
204 unsigned long GetRemoteHost() WARN_SINGLE_HOMING;
205 int GetSecLevel();
206 unsigned short GetRemotePort();
207};
208
210 RPC2_Handle key;
211
212public:
215};
216
217#define RESCOMM_MAXBSLEN 2048
218
219#endif /* _RES_COMM_H_ */
Definition: rescomm.h:119
RepResCommCtxt()
Definition: rescomm.cc:96
RPC2_Integer retcodes[VSG_MEMBERS]
Definition: rescomm.h:124
unsigned long hosts[VSG_MEMBERS]
Definition: rescomm.h:123
unsigned dying[VSG_MEMBERS]
Definition: rescomm.h:127
~RepResCommCtxt()
Definition: rescomm.cc:109
unsigned long primaryhost
Definition: rescomm.h:125
RPC2_Handle handles[VSG_MEMBERS]
Definition: rescomm.h:122
RPC2_Integer HowMany
Definition: rescomm.h:121
void print()
Definition: rescomm.cc:111
RPC2_Multicast * MIp
Definition: rescomm.h:126
Definition: binding.h:41
Definition: rescomm.h:209
conninfo * operator()()
Definition: rescomm.cc:725
Definition: rescomm.h:182
friend class conninfo_iterator
Definition: rescomm.h:183
unsigned long GetRemoteHost() WARN_SINGLE_HOMING
Definition: rescomm.cc:705
friend long RS_NewConnection(RPC2_Handle, RPC2_Integer, RPC2_Integer, RPC2_Integer, RPC2_Integer, RPC2_CountedBS *)
Definition: resutil.cc:65
unsigned short GetRemotePort()
Definition: rescomm.cc:715
friend void ResCommInit()
Definition: rescomm.cc:80
int GetSecLevel()
Definition: rescomm.cc:710
Definition: dlist.h:80
Definition: dlist.h:50
Definition: olist.h:75
Definition: olist.h:47
Definition: rescomm.h:137
static int resmgrps
Definition: rescomm.h:143
unsigned inuse
Definition: rescomm.h:153
unsigned dying
Definition: rescomm.h:154
RepResCommCtxt rrcc
Definition: rescomm.h:155
int GetHostSet(unsigned long *)
Definition: rescomm.cc:224
int CreateMember(unsigned long)
Definition: rescomm.cc:153
RPC2_Multicast McastInfo
Definition: rescomm.h:149
unsigned long Hosts[VSG_MEMBERS]
Definition: rescomm.h:150
static dlist * ResMgrpTab
Definition: rescomm.h:140
void KillMember(unsigned long, int)
Definition: rescomm.cc:194
res_mgrpent(unsigned long hosts[VSG_MEMBERS], RPC2_Handle)
Definition: rescomm.cc:130
void PutHostSet()
Definition: rescomm.cc:246
void print()
Definition: rescomm.cc:299
~res_mgrpent()
Definition: rescomm.cc:143
int IncompleteVSG()
Definition: rescomm.cc:281
dlink tblhandle
Definition: rescomm.h:146
int CheckResult()
Definition: rescomm.cc:259
Definition: rescomm.h:173
resmgrp_iterator(unsigned long hosts[VSG_MEMBERS]=ALL_VSGS)
Definition: rescomm.cc:317
res_mgrpent * operator()()
Definition: rescomm.cc:328
Definition: rescomm.h:113
srv_iterator()
Definition: rescomm.cc:580
srvent * operator()()
Definition: rescomm.cc:585
Definition: rescomm.h:73
int ServerIsUp()
Definition: rescomm.cc:557
void print()
Definition: rescomm.cc:562
int Connect(RPC2_Handle *, int)
Definition: rescomm.cc:432
friend void ResCheckServerLWP_worker(void *)
Definition: rescomm.cc:755
friend srvent * FindServer(unsigned long)
Definition: rescomm.cc:344
friend void GetServer(srvent **, unsigned long)
Definition: rescomm.cc:357
void Reset()
Definition: rescomm.cc:486
int ServerIsDown()
Definition: rescomm.cc:552
friend void ResCommInit()
Definition: rescomm.cc:80
void ServerError(int *)
Definition: rescomm.cc:510
friend void ServerPrint(int)
Definition: rescomm.cc:390
servers
Definition: gensrvstats.py:224
name
Definition: pwdtopdbtool.py:40
long ViceResolve(RPC2_Handle, ViceFid *)
int GetResMgroup(res_mgrpent **, unsigned long hosts[VSG_MEMBERS])
Definition: rescomm.cc:596
void ResMgrpPrint(int)
Definition: rescomm.cc:671
srvent * FindServer(unsigned long)
Definition: rescomm.cc:344
void GetServer(srvent **, unsigned long)
Definition: rescomm.cc:357
void PutServer(srvent **)
Definition: rescomm.cc:373
void ResCommInit()
Definition: rescomm.cc:80
int PutResMgroup(res_mgrpent **)
Definition: rescomm.cc:634
conninfo * GetConnectionInfo(RPC2_Handle)
Definition: rescomm.cc:735
void ServerPrint(int)
Definition: rescomm.cc:390
int32_t RPC2_Integer
Definition: rpc2.h:297
RPC2_Integer RPC2_Handle
Definition: rpc2.h:345
bit32 HostAddress[] WARN_SINGLE_HOMING
Definition: rpc2.h:316
Definition: rpc2.h:601