2 * Copyright (C) 1993,1994 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
5 * Copyright (C) 2005 Neil Cafferkey
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 #ifndef ACCESSCONTROL_H
24 #define ACCESSCONTROL_H
26 #include <sys/syslog.h>
28 #include <kern/amiga_netdb.h>
31 int controlaccess(struct in_addr shost
, unsigned short sport
);
33 static inline void setup_accesscontroltable(struct NetDataBase
* ndb
)
35 void * new_AccessTable
;
36 *((ULONG
*)&ndb
->ndb_AccessTable
[ndb
->ndb_AccessCount
]) = 0; /*mark default*/
39 bsd_realloc(ndb
->ndb_AccessTable
,
40 ndb
->ndb_AccessCount
* sizeof (struct AccessItem
) +
41 sizeof (ULONG
), M_NETDB
, M_WAITOK
);
44 ndb
->ndb_AccessTable
= new_AccessTable
;
46 __log(7, "Reallocated accesscontroltable to 0x%08x:", new_AccessTable
);
49 #define host ndb->ndb_AccessTable[i].ai_host
50 #define mask ndb->ndb_AccessTable[i].ai_mask
51 for (i
= 0; i
< ndb
->ndb_AccessCount
; i
++)
52 __log(7, "%ld %ld.%ld.%ld.%ld/%ld.%ld.%ld.%ld %lx",
53 ndb
->ndb_AccessTable
[i
].ai_port
,
54 host
>>24 & 0xff, host
>>16 & 0xff, host
>>8 & 0xff, host
& 0xff,
55 mask
>>24 & 0xff, mask
>>16 & 0xff, mask
>>8 & 0xff, mask
& 0xff,
56 ndb
->ndb_AccessTable
[i
].ai_flags
);
58 __log(7, "%ld %ld", ndb
->ndb_AccessTable
[i
].ai_flags
,
59 /* */ ndb
->ndb_AccessTable
[i
].ai_port
);
66 __log(LOG_EMERG
, "Memory exhausted while reallocating access control table");
68 #endif /* ACCESSCONTROL_H */