tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / workbench / network / stacks / AROSTCP / bsdsocket / kern / amiga_netdb.h
blob9adf57aa7b20f68abee1847f7677578d8ecf1ff4
1 /*
2 * Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
4 * All rights reserved.
5 * Copyright (C) 2005 Neil Cafferkey
6 * Copyright (C) 2005 Pavel Fedin
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 * MA 02111-1307, USA.
24 #ifndef AMIGA_NETDB_H
25 #define AMIGA_NETDB_H
27 #ifndef NETDB_H
28 #include <netdb.h>
29 #endif
31 #include "net/netdbpaths.h"
33 #ifndef IN_H
34 #include <netinet/in.h>
35 #endif
37 /* Access control table item */
38 struct AccessItem {
39 UWORD ai_flags;
40 UWORD ai_port;
41 ULONG ai_host;
42 ULONG ai_mask;
45 /* Access control flags */
46 #define ACF_ALLOW 0x01
47 #define ACF_LOG 0x02
48 #define ACF_PRIVONLY 0x04 /* 0 as port matches for privileged ports only */
49 #define ACF_CONTINUE (1 << 15)
51 /* AC table temporary buffer size */
52 #define TMPACTSIZE 0x4000
54 /* NetDataBase */
55 struct NetDataBase {
56 struct MinList ndb_Hosts;
57 struct MinList ndb_Networks;
58 struct MinList ndb_Services;
59 struct MinList ndb_Protocols;
60 struct MinList ndb_NameServers;
61 struct MinList ndb_Rc;
62 struct MinList ndb_Domains;
63 LONG ndb_AccessCount; /* tmp var, but reduces code size */
64 struct AccessItem * ndb_AccessTable;
67 extern struct NetDataBase *NDB;
68 extern struct SignalSemaphore ndb_Lock;
69 extern struct DynDataBase DynDB;
70 extern ULONG ndb_Serial;
72 /* Locking macros for NDB */
73 #define LOCK_W_NDB(ndb) (ObtainSemaphore(&ndb_Lock))
74 #define LOCK_R_NDB(ndb) (ObtainSemaphoreShared(&ndb_Lock))
75 #define UNLOCK_NDB(ndb) (ReleaseSemaphore(&ndb_Lock))
76 #define ATTEMPT_NDB(ndb) (AttemptSemaphore(&ndb_Lock))
78 /* Dynamic part of the NetDB */
79 struct DynDataBase {
80 struct SignalSemaphore dyn_Lock;
81 struct MinList dyn_NameServers;
82 struct MinList dyn_Domains;
86 * GenEnt has the common part of all NetDataBase Nodes
88 struct GenentNode {
89 struct MinNode gn_Node;
90 short gn_EntSize;
91 struct {
92 char *dummy[0];
93 } gn_Ent;
96 /* NetDatabase nodes */
97 struct NameserventNode {
98 struct MinNode nsn_Node;
99 short nsn_EntSize;
100 struct nameservent {
101 struct in_addr ns_addr;
102 } nsn_Ent;
105 struct DomainentNode {
106 struct MinNode dn_Node;
107 short dn_EntSize;
108 struct domainent {
109 char *d_name;
110 } dn_Ent;
113 /* NetDataBase Nodes */
114 struct HostentNode {
115 struct MinNode hn_Node;
116 short hn_EntSize;
117 struct hostent hn_Ent;
120 struct NetentNode {
121 struct MinNode nn_Node;
122 short nn_EntSize;
123 struct netent nn_Ent;
126 struct ServentNode {
127 struct MinNode sn_Node;
128 short sn_EntSize;
129 struct servent sn_Ent;
132 struct ProtoentNode {
133 struct MinNode pn_Node;
134 short pn_EntSize;
135 struct protoent pn_Ent;
138 struct RcentNode {
139 struct MinNode rn_Node;
140 short rn_EntSize;
141 char * rn_Ent;
145 * netdatabase calls for some AmiTCP/IP functions
147 struct ServentNode * findServentNode(struct NetDataBase * ndb,
148 const char * name, const char * proto);
151 * Read NetDB...
153 LONG do_netdb(struct CSource *cs, UBYTE **errstrp, struct CSource *res);
154 LONG reset_netdb(struct CSource *cs, UBYTE **errstrp, struct CSource *res);
155 LONG init_netdb(void);
156 void netdb_deinit(void);
158 #endif /* AMIGA_NETDB_H */