Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / netatalk / at.h @ 14

History | View | Annotate | Download (2.83 KB)

1
/*        $NetBSD: at.h,v 1.8 2014/12/02 19:33:44 christos Exp $        */
2

    
3
/*
4
 * Copyright (c) 1990,1991 Regents of The University of Michigan.
5
 * All Rights Reserved.
6
 *
7
 * Permission to use, copy, modify, and distribute this software and
8
 * its documentation for any purpose and without fee is hereby granted,
9
 * provided that the above copyright notice appears in all copies and
10
 * that both that copyright notice and this permission notice appear
11
 * in supporting documentation, and that the name of The University
12
 * of Michigan not be used in advertising or publicity pertaining to
13
 * distribution of the software without specific, written prior
14
 * permission. This software is supplied as is without expressed or
15
 * implied warranties of any kind.
16
 *
17
 * This product includes software developed by the University of
18
 * California, Berkeley and its contributors.
19
 *
20
 *        Research Systems Unix Group
21
 *        The University of Michigan
22
 *        c/o Wesley Craig
23
 *        535 W. William Street
24
 *        Ann Arbor, Michigan
25
 *        +1-313-764-2278
26
 *        netatalk@umich.edu
27
 */
28

    
29
#ifndef _NETATALK_AT_H_
30
#define _NETATALK_AT_H_
31

    
32
#include <sys/ansi.h>
33

    
34
#ifndef sa_family_t
35
typedef __sa_family_t        sa_family_t;
36
#define sa_family_t        __sa_family_t
37
#endif
38

    
39
/*
40
 * Supported protocols
41
 */
42
#define ATPROTO_DDP        0
43
#define ATPROTO_AARP        254
44

    
45
#define DDP_MAXSZ        587
46

    
47
/*
48
 * If ATPORT_FIRST <= Port < ATPORT_RESERVED,
49
 * Port was created by a privileged process.
50
 * If ATPORT_RESERVED <= Port < ATPORT_LAST,
51
 * Port was not necessarily created by a
52
 * privileged process.
53
 */
54
#define ATPORT_FIRST        1
55
#define ATPORT_RESERVED        128
56
#define ATPORT_LAST        255
57

    
58
/*
59
 * AppleTalk address.
60
 */
61
struct at_addr {
62
        uint16_t         s_net;
63
        uint8_t          s_node;
64
};
65

    
66
#define ATADDR_ANYNET        (uint16_t)0x0000
67
#define ATADDR_ANYNODE        (uint8_t)0x00
68
#define ATADDR_ANYPORT        (uint8_t)0x00
69
#define ATADDR_BCAST        (uint8_t)0xff        /* There is no BCAST for NET */
70

    
71
struct netrange {
72
        uint8_t                nr_phase;
73
        uint16_t        nr_firstnet;
74
        uint16_t        nr_lastnet;
75
};
76

    
77
/*
78
 * Socket address, AppleTalk style.  We keep magic information in the
79
 * zero bytes.  There are three types, NONE, CONFIG which has the phase
80
 * and a net range, and IFACE which has the network address of an
81
 * interface.  IFACE may be filled in by the client, and is filled in
82
 * by the kernel.
83
 */
84
struct sockaddr_at {
85
        uint8_t                sat_len;
86
        sa_family_t        sat_family;
87
        uint8_t                sat_port;
88
        struct at_addr  sat_addr;
89
        union {
90
                struct netrange r_netrange;
91
                char            r_zero[8];        /* Hide a struct netrange in
92
                                                 * here */
93
        } sat_range;
94
};
95

    
96
#define sat_zero sat_range.r_zero
97

    
98
#ifdef _KERNEL
99
#include <sys/protosw.h>
100

    
101
extern struct domain atalkdomain;
102
extern const struct protosw atalksw[];
103
#endif
104

    
105
#if defined(_KERNEL) || defined(_TEST)
106
#define ATALK_ADDRSTRLEN 10
107

    
108
extern struct domain atalkdomain;
109
int at_print(char *, size_t, const struct at_addr *);
110
int sat_print(char *, size_t, const void *);
111
#endif
112

    
113
#endif        /* !_NETATALK_AT_H_ */