Cleanup of netatalk atalk layer includes, protocol definitions, and
routing: - style(9) cleanup -- white space, braces, etc. - Make include guards consistent with our more general naming convention. - Rearrange and complete forward structure declarations in at_extern.h, remove testing of guards of various other include files to protect function declarations. This leaves an ifdef _KERNEL in at_var.h, but from inspection it seems likely that this file is not actually safe for inclusion in user space still. However, since it's not included from within src/ so this does not appear to be an issue (ifconfig, etc, have migrated to the generic cross-protocol ioctls for address operations).
This commit is contained in:
parent
ccc086813d
commit
751716e050
@ -23,64 +23,64 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __AT_HEADER__
|
||||
#define __AT_HEADER__
|
||||
#ifndef _NETATALK_AT_H_
|
||||
#define _NETATALK_AT_H_
|
||||
|
||||
/*
|
||||
* Supported protocols
|
||||
*/
|
||||
#define ATPROTO_DDP 0
|
||||
#define ATPROTO_AARP 254
|
||||
#define ATPROTO_DDP 0
|
||||
#define ATPROTO_AARP 254
|
||||
|
||||
#define DDP_MAXSZ 587
|
||||
#define DDP_MAXSZ 587
|
||||
|
||||
/*
|
||||
* If ATPORT_FIRST <= Port < ATPORT_RESERVED,
|
||||
* Port was created by a privileged process.
|
||||
* If ATPORT_RESERVED <= Port < ATPORT_LAST,
|
||||
* Port was not necessarily created by a
|
||||
* If ATPORT_FIRST <= Port < ATPORT_RESERVED, the port was created by a
|
||||
* privileged process.
|
||||
*
|
||||
* If ATPORT_RESERVED <= Port < ATPORT_LAST, the port was not necessarily
|
||||
* created by a privileged process.
|
||||
*/
|
||||
#define ATPORT_FIRST 1
|
||||
#define ATPORT_RESERVED 128
|
||||
#define ATPORT_LAST 255
|
||||
#define ATPORT_FIRST 1
|
||||
#define ATPORT_RESERVED 128
|
||||
#define ATPORT_LAST 255
|
||||
|
||||
/*
|
||||
* AppleTalk address.
|
||||
*/
|
||||
struct at_addr {
|
||||
u_short s_net;
|
||||
u_char s_node;
|
||||
u_short s_net;
|
||||
u_char s_node;
|
||||
};
|
||||
|
||||
#define ATADDR_ANYNET (u_short)0x0000
|
||||
#define ATADDR_ANYNODE (u_char)0x00
|
||||
#define ATADDR_ANYPORT (u_char)0x00
|
||||
#define ATADDR_BCAST (u_char)0xff /* There is no BCAST for NET */
|
||||
#define ATADDR_ANYNET (u_short)0x0000
|
||||
#define ATADDR_ANYNODE (u_char)0x00
|
||||
#define ATADDR_ANYPORT (u_char)0x00
|
||||
#define ATADDR_BCAST (u_char)0xff /* There is no BCAST for NET. */
|
||||
|
||||
struct netrange {
|
||||
u_char nr_phase;
|
||||
u_short nr_firstnet;
|
||||
u_short nr_lastnet;
|
||||
u_char nr_phase;
|
||||
u_short nr_firstnet;
|
||||
u_short nr_lastnet;
|
||||
};
|
||||
|
||||
/*
|
||||
* Socket address, AppleTalk style. We keep magic information in the
|
||||
* zero bytes. There are three types, NONE, CONFIG which has the phase
|
||||
* and a net range, and IFACE which has the network address of an
|
||||
* interface. IFACE may be filled in by the client, and is filled in
|
||||
* by the kernel.
|
||||
* Socket address, AppleTalk style. We keep magic information in the zero
|
||||
* bytes. There are three types, NONE, CONFIG which has the phase and a net
|
||||
* range, and IFACE which has the network address of an interface. IFACE may
|
||||
* be filled in by the client, and is filled in by the kernel.
|
||||
*/
|
||||
struct sockaddr_at {
|
||||
u_char sat_len;
|
||||
u_char sat_family;
|
||||
u_char sat_port;
|
||||
struct at_addr sat_addr;
|
||||
union {
|
||||
struct netrange r_netrange;
|
||||
char r_zero[ 8 ]; /* Hide a struct netrange in here */
|
||||
} sat_range;
|
||||
u_char sat_len;
|
||||
u_char sat_family;
|
||||
u_char sat_port;
|
||||
struct at_addr sat_addr;
|
||||
union {
|
||||
struct netrange r_netrange;
|
||||
char r_zero[8]; /* Hide struct netrange here. */
|
||||
} sat_range;
|
||||
};
|
||||
|
||||
#define sat_zero sat_range.r_zero
|
||||
#define sat_zero sat_range.r_zero
|
||||
|
||||
#endif /* !__AT_HEADER__ */
|
||||
#endif /* !_NETATALK_AT_H_ */
|
||||
|
@ -25,52 +25,40 @@
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
struct mbuf;
|
||||
struct sockaddr_at;
|
||||
|
||||
#ifdef _NET_IF_ARP_H_
|
||||
extern timeout_t aarpprobe;
|
||||
extern int aarpresolve (struct ifnet *,
|
||||
struct mbuf *,
|
||||
struct sockaddr_at *,
|
||||
u_char *);
|
||||
extern int at_broadcast (struct sockaddr_at *);
|
||||
#ifndef _NETATALK_AT_EXTERN_H_
|
||||
#define _NETATALK_AT_EXTERN_H_
|
||||
|
||||
extern struct mtx aarptab_mtx;
|
||||
extern struct mtx aarptab_mtx;
|
||||
|
||||
#define AARPTAB_LOCK() mtx_lock(&aarptab_mtx)
|
||||
#define AARPTAB_UNLOCK() mtx_unlock(&aarptab_mtx)
|
||||
#define AARPTAB_LOCK_ASSERT() mtx_assert(&aarptab_mtx, MA_OWNED)
|
||||
#define AARPTAB_UNLOCK_ASSERT() mtx_assert(&aarptab_mtx, MA_NOTOWNED)
|
||||
#endif
|
||||
|
||||
struct at_ifaddr;
|
||||
struct ifnet;
|
||||
struct mbuf;
|
||||
struct route;
|
||||
struct thread;
|
||||
struct sockaddr_at;
|
||||
struct socket;
|
||||
void aarpintr(struct mbuf *);
|
||||
void aarpprobe(void *arg);
|
||||
int aarpresolve(struct ifnet *, struct mbuf *,
|
||||
struct sockaddr_at *, u_char *);
|
||||
void aarp_clean(void);
|
||||
void at1intr(struct mbuf *);
|
||||
void at2intr(struct mbuf *);
|
||||
int at_broadcast(struct sockaddr_at *);
|
||||
u_short at_cksum(struct mbuf *m, int skip);
|
||||
int at_control(struct socket *so, u_long cmd, caddr_t data,
|
||||
struct ifnet *ifp, struct thread *td);
|
||||
struct at_ifaddr *at_ifawithnet(struct sockaddr_at *);
|
||||
void ddp_init(void);
|
||||
int ddp_output(struct mbuf *m, struct socket *so);
|
||||
int ddp_route(struct mbuf *m, struct route *ro);
|
||||
struct ddpcb *ddp_search(struct sockaddr_at *, struct sockaddr_at *,
|
||||
struct at_ifaddr *);
|
||||
|
||||
extern void aarpintr (struct mbuf *);
|
||||
extern void at1intr (struct mbuf *);
|
||||
extern void at2intr (struct mbuf *);
|
||||
extern void aarp_clean (void);
|
||||
extern int at_control (struct socket *so,
|
||||
u_long cmd,
|
||||
caddr_t data,
|
||||
struct ifnet *ifp,
|
||||
struct thread *td);
|
||||
extern u_short at_cksum (struct mbuf *m, int skip);
|
||||
extern void ddp_init (void);
|
||||
extern struct at_ifaddr *at_ifawithnet (struct sockaddr_at *);
|
||||
#ifdef _NETATALK_DDP_VAR_H_
|
||||
extern int ddp_output (struct mbuf *m, struct socket *so);
|
||||
|
||||
#endif
|
||||
#if defined (_NETATALK_DDP_VAR_H_) && defined(_NETATALK_AT_VAR_H_)
|
||||
extern struct ddpcb *ddp_search(struct sockaddr_at *,
|
||||
struct sockaddr_at *,
|
||||
struct at_ifaddr *);
|
||||
#endif
|
||||
#ifdef _NET_ROUTE_H_
|
||||
int ddp_route(struct mbuf *m, struct route *ro);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* !_NETATALK_AT_EXTERN_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 1990,1991 Regents of The University of Michigan.
|
||||
* Copyright (c) 1990, 1991 Regents of The University of Michigan.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
@ -39,16 +39,16 @@
|
||||
static struct domain atalkdomain;
|
||||
|
||||
static struct protosw atalksw[] = {
|
||||
{
|
||||
/* Identifiers */
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &atalkdomain,
|
||||
.pr_protocol = ATPROTO_DDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_output = ddp_output,
|
||||
.pr_init = ddp_init,
|
||||
.pr_usrreqs = &ddp_usrreqs
|
||||
},
|
||||
{
|
||||
/* Identifiers */
|
||||
.pr_type = SOCK_DGRAM,
|
||||
.pr_domain = &atalkdomain,
|
||||
.pr_protocol = ATPROTO_DDP,
|
||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
||||
.pr_output = ddp_output,
|
||||
.pr_init = ddp_init,
|
||||
.pr_usrreqs = &ddp_usrreqs,
|
||||
},
|
||||
};
|
||||
|
||||
static struct domain atalkdomain = {
|
||||
@ -58,8 +58,7 @@ static struct domain atalkdomain = {
|
||||
.dom_protoswNPROTOSW = &atalksw[sizeof(atalksw)/sizeof(atalksw[0])],
|
||||
.dom_rtattach = rn_inithead,
|
||||
.dom_rtoffset = offsetof(struct sockaddr_at, sat_addr) << 3,
|
||||
.dom_maxrtkey = sizeof(struct sockaddr_at)
|
||||
.dom_maxrtkey = sizeof(struct sockaddr_at),
|
||||
};
|
||||
|
||||
DOMAIN_SET(atalk);
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/* This code generates debugging traces to the radix code */
|
||||
/* This code generates debugging traces to the radix code. */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <net/route.h>
|
||||
|
||||
int at_inithead(void **head, int off);
|
||||
int at_inithead(void **head, int off);
|
||||
|
||||
#define HEXBUF_LEN 256
|
||||
|
||||
@ -55,13 +55,13 @@ prsockaddr(void *v, char *hexbuf)
|
||||
/* return: "(len) hexdump" */
|
||||
|
||||
bp += sprintf(bp, "(%d)", len);
|
||||
for (cp++; cp < cplim && bp < hexbuf + (HEXBUF_LEN - 4); cp++) {
|
||||
for (cp++; cp < cplim && bp < hexbuf + (HEXBUF_LEN - 4);
|
||||
cp++) {
|
||||
*bp++ = "0123456789abcdef"[*cp / 16];
|
||||
*bp++ = "0123456789abcdef"[*cp % 16];
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
bp+= sprintf(bp, "null");
|
||||
}
|
||||
*bp = '\0';
|
||||
return (hexbuf);
|
||||
}
|
||||
@ -75,14 +75,14 @@ at_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
|
||||
|
||||
printf("at_addroute: v=%s\n", prsockaddr(v_arg, hexbuf));
|
||||
printf("at_addroute: n=%s\n", prsockaddr(n_arg, hexbuf));
|
||||
printf("at_addroute: head=%p treenodes=%p\n",
|
||||
(void *)head, (void *)treenodes);
|
||||
printf("at_addroute: head=%p treenodes=%p\n", (void *)head,
|
||||
(void *)treenodes);
|
||||
|
||||
rn = rn_addroute(v_arg, n_arg, head, treenodes);
|
||||
|
||||
printf("at_addroute: returns rn=%p\n", (void *)rn);
|
||||
|
||||
return rn;
|
||||
return (rn);
|
||||
}
|
||||
|
||||
static struct radix_node *
|
||||
@ -98,7 +98,7 @@ at_matroute(void *v_arg, struct radix_node_head *head)
|
||||
|
||||
printf("at_matroute: returnr rn=%p\n", (void *)rn);
|
||||
|
||||
return rn;
|
||||
return (rn);
|
||||
}
|
||||
|
||||
static struct radix_node *
|
||||
@ -115,10 +115,10 @@ at_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
|
||||
|
||||
printf("at_lookup: returns rn=%p\n", (void *)rn);
|
||||
|
||||
return rn;
|
||||
return (rn);
|
||||
}
|
||||
|
||||
static struct radix_node *
|
||||
static struct radix_node *
|
||||
at_delroute(void *v_arg, void *netmask_arg, struct radix_node_head *head)
|
||||
{
|
||||
struct radix_node *rn;
|
||||
@ -132,7 +132,7 @@ at_delroute(void *v_arg, void *netmask_arg, struct radix_node_head *head)
|
||||
|
||||
printf("at_delroute: returns rn=%p\n", (void *)rn);
|
||||
|
||||
return rn;
|
||||
return (rn);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -143,13 +143,13 @@ at_inithead(void **head, int off)
|
||||
{
|
||||
struct radix_node_head *rnh;
|
||||
|
||||
if(!rn_inithead(head, off))
|
||||
return 0;
|
||||
if (!rn_inithead(head, off))
|
||||
return (0);
|
||||
|
||||
rnh = *head;
|
||||
rnh->rnh_addaddr = at_addroute;
|
||||
rnh->rnh_deladdr = at_delroute;
|
||||
rnh->rnh_matchaddr = at_matroute;
|
||||
rnh->rnh_lookup = at_lookup;
|
||||
return 1;
|
||||
return (1);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 1990,1991 Regents of The University of Michigan.
|
||||
* Copyright (c) 1990, 1991 Regents of The University of Michigan.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
@ -24,40 +24,41 @@
|
||||
*/
|
||||
|
||||
#ifndef _NETATALK_AT_VAR_H_
|
||||
#define _NETATALK_AT_VAR_H_ 1
|
||||
#define _NETATALK_AT_VAR_H_
|
||||
|
||||
/*
|
||||
* For phase2, we need to keep not only our address on an interface,
|
||||
* but also the legal networks on the interface.
|
||||
* For phase2, we need to keep not only our address on an interface, but also
|
||||
* the legal networks on the interface.
|
||||
*/
|
||||
struct at_ifaddr {
|
||||
struct ifaddr aa_ifa;
|
||||
# define aa_ifp aa_ifa.ifa_ifp
|
||||
struct sockaddr_at aa_addr;
|
||||
struct sockaddr_at aa_broadaddr;
|
||||
# define aa_dstaddr aa_broadaddr;
|
||||
struct sockaddr_at aa_netmask;
|
||||
int aa_flags;
|
||||
u_short aa_firstnet, aa_lastnet;
|
||||
int aa_probcnt;
|
||||
struct callout aa_callout;
|
||||
struct at_ifaddr *aa_next;
|
||||
struct ifaddr aa_ifa;
|
||||
struct sockaddr_at aa_addr;
|
||||
struct sockaddr_at aa_broadaddr;
|
||||
struct sockaddr_at aa_netmask;
|
||||
int aa_flags;
|
||||
u_short aa_firstnet;
|
||||
u_short aa_lastnet;
|
||||
int aa_probcnt;
|
||||
struct callout aa_callout;
|
||||
struct at_ifaddr *aa_next;
|
||||
};
|
||||
#define aa_ifp aa_ifa.ifa_ifp
|
||||
#define aa_dstaddr aa_broadaddr;
|
||||
|
||||
struct at_aliasreq {
|
||||
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
struct sockaddr_at ifra_addr;
|
||||
struct sockaddr_at ifra_broadaddr;
|
||||
#define ifra_dstaddr ifra_broadaddr
|
||||
struct sockaddr_at ifra_mask;
|
||||
char ifra_name[IFNAMSIZ];
|
||||
struct sockaddr_at ifra_addr;
|
||||
struct sockaddr_at ifra_broadaddr;
|
||||
struct sockaddr_at ifra_mask;
|
||||
};
|
||||
#define ifra_dstaddr ifra_broadaddr
|
||||
|
||||
#define AA_SAT(aa) \
|
||||
(&(aa->aa_addr))
|
||||
#define satosat(sa) ((struct sockaddr_at *)(sa))
|
||||
#define AA_SAT(aa) (&(aa->aa_addr))
|
||||
#define satosat(sa) ((struct sockaddr_at *)(sa))
|
||||
|
||||
#define AFA_ROUTE 0x0001
|
||||
#define AFA_PROBING 0x0002
|
||||
#define AFA_PHASE2 0x0004
|
||||
#define AFA_ROUTE 0x0001
|
||||
#define AFA_PROBING 0x0002
|
||||
#define AFA_PHASE2 0x0004
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern struct at_ifaddr *at_ifaddr_list;
|
||||
|
Loading…
Reference in New Issue
Block a user