2 * Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
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,
31 #include "net/netdbpaths.h"
34 #include <netinet/in.h>
37 /* Access control table item */
45 /* Access control flags */
46 #define ACF_ALLOW 0x01
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
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 */
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
89 struct MinNode gn_Node
;
96 /* NetDatabase nodes */
97 struct NameserventNode
{
98 struct MinNode nsn_Node
;
101 struct in_addr ns_addr
;
105 struct DomainentNode
{
106 struct MinNode dn_Node
;
113 /* NetDataBase Nodes */
115 struct MinNode hn_Node
;
117 struct hostent hn_Ent
;
121 struct MinNode nn_Node
;
123 struct netent nn_Ent
;
127 struct MinNode sn_Node
;
129 struct servent sn_Ent
;
132 struct ProtoentNode
{
133 struct MinNode pn_Node
;
135 struct protoent pn_Ent
;
139 struct MinNode rn_Node
;
145 * netdatabase calls for some AmiTCP/IP functions
147 struct ServentNode
* findServentNode(struct NetDataBase
* ndb
,
148 const char * name
, const char * proto
);
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 */