|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25:
26: /*
27: * Copyright (c) 1988, 1989 Apple Computer, Inc.
28: *
29: * The information contained herein is subject to change without
30: * notice and should not be construed as a commitment by Apple
31: * Computer, Inc. Apple Computer, Inc. assumes no responsibility
32: * for any errors that may appear.
33: *
34: * Confidential and Proprietary to Apple Computer, Inc.
35: */
36:
37: /* "@(#)at_ddp.h: 2.0, 1.14; 7/14/92; Copyright 1988-89, Apple Computer, Inc." */
38: #include <at/at_lap.h>
39: #include <at/elap.h>
40:
41: /* DDP short header used internal to the ddp module. */
42: typedef struct {
43: unsigned unused:6,
44: length:10; /* Datagram length */
45: at_socket dst_socket; /* Destination socket number. */
46: at_socket src_socket; /* Source socket number. */
47: u_char type; /* Protocol type. */
48: u_char data[594]; /* The DataGram buffer. */
49: } at_ddp_short_t;
50:
51: typedef struct {
52: at_socket number; /* the number of this socket */
53: u_char flags;
54: u_char otChecksum;
55: u_char otType;
56: u_long otPeerAddr;
57: union {
58: gref_t *gref; /* Upstream pointer */
59: void (*handler)(); /* Upstream handler routine */
60: } sock_u;
61: void *dev;
62: } ddp_socket_t;
63: /* consts for flags above */
64: #define DDP_CALL_HANDLER 0x01 /* upstream is pointer to a routine */
65: #define DDP_SOCK_UPQ(socket) ddp_socket[socket].sock_u.gref
66: #define DDP_SOCK_HANDLER(socket) ddp_socket[socket].sock_u.handler
67:
68: /* Table of minor numbers used */
69: typedef struct {
70: u_char flags; /* See below */
71: u_char proto;
72: ddp_socket_t *sock_entry; /* pointer to the socket table entry */
73: int pid;
74: } ddp_dev_t;
75:
76: /* Flags for the device table */
77: #define DDPF_ALLOCATED 0x1 /* This device is active */
78: #define DDPF_SHUTDOWN 0x2 /* Shutdown occurred; don't use */
79: #define DDPF_OT 0x04 /* OT interface channel */
80: #define DDPF_LINKSTR 0x08 /* proto interface channel */
81: #define DDPF_SI 0x10 /* socket interface channel */
82:
83: #define DDP_FLAGS(Q) (((ddp_dev_t *)((Q)->info))->flags)
84: #define DDP_SOCKENTRY(Q) (((ddp_dev_t *)((Q)->info))->sock_entry)
85: #define DDP_SOCKNUM(Q) (DDP_SOCKENTRY(Q)->number)
86: #define DDP_SOCKEVENT(Q) (DDP_SOCKENTRY(Q)->eventq)
87:
88: extern ddp_socket_t ddp_socket[];
89: extern at_if_t *at_ifDefault;
90:
91: #define DDP_STARTUP_LOW 0xff00
92: #define DDP_STARTUP_HIGH 0xfffe
93:
94: typedef struct {
95: void **inputQ;
96: int *pidM;
97: char **socketM;
98: char *dbgBits;
99: } proto_reg_t;
100:
101: #define FROM_US(ddp) (NET_EQUAL(ddp->src_net,\
102: ifID_table[IFID_HOME]->ifThisNode.atalk_net) && \
103: ifID_table[IFID_HOME]->ifThisNode.atalk_node == ddp->src_node)
104:
105: /* Queue format expected by queue instructions */
106: typedef struct LIB_QELEM {
107: struct LIB_QELEM *q_forw;
108: struct LIB_QELEM *q_back;
109: } LIB_QELEM_T;
110:
111: /* from sys_glue.c */
112: int ddp_adjmsg(gbuf_t *m, int len);
113: gbuf_t *ddp_growmsg(gbuf_t *mp, int len);
114: void ddp_insque(LIB_QELEM_T *elem, LIB_QELEM_T *prev);
115: void ddp_remque(LIB_QELEM_T *elem);
116:
117: /* from ddp.c */
118: int ddp_add_if(at_if_t *ifID);
119: int ddp_rem_if(at_if_t *ifID);
120: int ddp_get_cfg(at_ddp_cfg_t *cfgp, at_socket src_socket);
121: int ddp_get_stats(at_ddp_stats_t *statsp);
122: int ddp_bind_socket(ddp_socket_t *socketp);
123: int ddp_close_socket(ddp_socket_t *socketp);
124: int ddp_output(gbuf_t **mp, at_socket src_socket, int src_addr_included);
125: void ddp_input(gbuf_t *mp, at_if_t *ifID);
126: int ddp_router_output(
127: gbuf_t *mp,
128: at_if_t *ifID,
129: int addr_type,
130: at_net_al router_net,
131: at_node router_node,
132: etalk_addr_t *enet_addr);
133:
134: /* from ddp_proto.c */
135: int ddp_open(gref_t *gref);
136: int ddp_close(gref_t *gref);
137: int ddp_putmsg(gref_t *gref, gbuf_t *mp);
138: char *ddps_init();
139: int ddps_shutdown(gref_t *grefInput);
140: gbuf_t *ddp_compress_msg(gbuf_t *mp);
141: void ddp_stop(gbuf_t *mioc, gref_t *gref);
142:
143: /* in ddp_lap.c */
144: void ddp_bit_reverse();
145:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.