Lines Matching +full:static +full:- +full:config
6 * in static memory; tli structures are allocated from the heap.
20 static char sccsid[] = "@(#) tli.c 1.15 97/03/21 19:27:25";
56 static void tli_endpoints();
57 static struct netconfig *tli_transport();
58 static void tli_hostname();
59 static void tli_hostaddr();
60 static void tli_cleanup();
61 static char *tli_error();
62 static void tli_sink();
64 /* tli_host - look up endpoint addresses and install conversion methods */
69 static struct sockaddr_storage client;
70 static struct sockaddr_storage server;
72 static struct sockaddr_in client;
73 static struct sockaddr_in server;
78 * were here. Otherwise, use the transport-independent method and stick
79 * to generic network addresses. XXX hard-coded protocol family name.
84 if ((request->config = tli_transport(request->fd)) != 0
85 && (STR_EQ(request->config->nc_protofmly, "inet") ||
86 STR_EQ(request->config->nc_protofmly, "inet6"))) {
88 if ((request->config = tli_transport(request->fd)) != 0
89 && STR_EQ(request->config->nc_protofmly, "inet")) {
91 if (request->client->unit != 0) {
93 client = *(struct sockaddr_storage *) request->client->unit->addr.buf;
94 request->client->sin = (struct sockaddr *) &client;
96 client = *(struct sockaddr_in *) request->client->unit->addr.buf;
97 request->client->sin = &client;
100 if (request->server->unit != 0) {
102 server = *(struct sockaddr_storage *) request->server->unit->addr.buf;
103 request->server->sin = (struct sockaddr *) &server;
105 server = *(struct sockaddr_in *) request->server->unit->addr.buf;
106 request->server->sin = &server;
112 request->hostname = tli_hostname;
113 request->hostaddr = tli_hostaddr;
114 request->cleanup = tli_cleanup;
118 /* tli_cleanup - cleanup some dynamically-allocated data structures */
120 static void tli_cleanup(struct request_info *request)
122 if (request->config != 0)
123 freenetconfigent(request->config);
124 if (request->client->unit != 0)
125 t_free((char *) request->client->unit, T_UNITDATA);
126 if (request->server->unit != 0)
127 t_free((char *) request->server->unit, T_UNITDATA);
130 /* tli_endpoints - determine TLI client and server endpoint information */
132 static void tli_endpoints(struct request_info *request)
136 int fd = request->fd;
145 * Beware of successful returns with zero-length netbufs (for example,
147 * handle that. Assume connection-less transport when TI_GETPEERNAME
156 if (ioctl(fd, TI_GETPEERNAME, &client->addr) < 0 || client->addr.len == 0) {
157 request->sink = tli_sink;
158 if (t_rcvudata(fd, client, &flags) < 0 || client->addr.len == 0) {
164 request->client->unit = client;
175 if (ioctl(fd, TI_GETMYNAME, &server->addr) < 0) {
180 request->server->unit = server;
183 /* tli_transport - find out TLI transport type */
185 static struct netconfig *tli_transport(int fd)
190 struct netconfig *config; local
206 while (config = getnetconfig(handlep)) {
207 if (stat(config->nc_device, &from_config) == 0) {
220 if (config == 0) {
230 if ((config = getnetconfigent(config->nc_netid)) == 0) {
231 tcpd_warn("getnetconfigent(%s): %s", config->nc_netid, nc_sperror());
234 return (config);
237 /* tli_hostaddr - map TLI transport address to printable address */
239 static void tli_hostaddr(struct host_info *host)
241 struct request_info *request = host->request;
242 struct netconfig *config = request->config; local
243 struct t_unitdata *unit = host->unit;
246 if (config != 0 && unit != 0
247 && (uaddr = taddr2uaddr(config, &unit->addr)) != 0) {
248 STRN_CPY(host->addr, uaddr, sizeof(host->addr));
253 /* tli_hostname - map TLI transport address to hostname */
255 static void tli_hostname(struct host_info *host)
257 struct request_info *request = host->request;
258 struct netconfig *config = request->config; local
259 struct t_unitdata *unit = host->unit;
262 if (config != 0 && unit != 0
263 && netdir_getbyaddr(config, &servlist, &unit->addr) == ND_OK) {
265 struct nd_hostserv *service = servlist->h_hostservs;
269 if (netdir_getbyname(config, service, &addr_list) != ND_OK) {
278 STRING_LENGTH, service->h_host);
294 for (i = 0; found == 0 && i < addr_list->n_cnt; i++) {
295 if ((ua = taddr2uaddr(config, &(addr_list->n_addrs[i]))) != 0) {
310 host->addr, STRING_LENGTH, service->h_host);
312 STRN_CPY(host->name, found ? service->h_host : paranoid,
313 sizeof(host->name));
318 /* tli_error - convert tli error number to text */
320 static char *tli_error()
322 static char buf[40];
341 /* tli_sink - absorb unreceived datagram */
343 static void tli_sink(int fd)