|
|
1.1 ! root 1: /* ! 2: * Mach Operating System ! 3: * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University ! 4: * All Rights Reserved. ! 5: * ! 6: * Permission to use, copy, modify and distribute this software and its ! 7: * documentation is hereby granted, provided that both the copyright ! 8: * notice and this permission notice appear in all copies of the ! 9: * software, derivative works or modified versions, and any portions ! 10: * thereof, and that both notices appear in supporting documentation. ! 11: * ! 12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ! 14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 15: * ! 16: * Carnegie Mellon requests users of this software to return to ! 17: * ! 18: * Software Distribution Coordinator or [email protected] ! 19: * School of Computer Science ! 20: * Carnegie Mellon University ! 21: * Pittsburgh PA 15213-3890 ! 22: * ! 23: * any improvements or extensions that they make and grant Carnegie Mellon ! 24: * the rights to redistribute these changes. ! 25: */ ! 26: ! 27: /*** NETWORK INTERFACE IMPLEMENTATION CORE ***/ ! 28: ! 29: #ifndef _NC_H_ ! 30: #define _NC_H_ ! 31: ! 32: #ifndef STUB ! 33: #include <chips/nw.h> ! 34: #else ! 35: #include "nw.h" ! 36: #endif ! 37: ! 38: /*** Types and data structures ***/ ! 39: ! 40: #if PRODUCTION ! 41: #define MAX_EP 1024 ! 42: #define MAX_DEV 16 ! 43: #else ! 44: #define MAX_EP 32 ! 45: #define MAX_DEV 3 ! 46: #endif ! 47: ! 48: #define MASTER_LINE_EP 0 ! 49: #define SIGNAL_EP 1 ! 50: ! 51: typedef struct nw_tx_headers { ! 52: nw_buffer_t buffer; ! 53: u_int msg_length; ! 54: char *block; ! 55: u_int block_length; ! 56: nw_peer_s peer; ! 57: nw_ep sender; ! 58: nw_options options; ! 59: struct nw_tx_headers *next; ! 60: } nw_tx_header_s; ! 61: ! 62: typedef nw_tx_header_s *nw_tx_header_t; ! 63: ! 64: typedef struct nw_rx_headers { ! 65: nw_buffer_t buffer; ! 66: nw_ep receiver; ! 67: u_int reply; ! 68: int time_stamp; ! 69: struct nw_rx_headers *next; ! 70: } nw_rx_header_s, *nw_rx_header_t; ! 71: ! 72: typedef enum { ! 73: NW_CONNECTIONLESS, ! 74: NW_CONNECTION_ORIENTED ! 75: } nw_dev_type; ! 76: ! 77: ! 78: typedef struct { ! 79: nw_result (*initialize)(int); ! 80: nw_result (*status)(int); ! 81: void (*slow_sweep)(int); ! 82: void (*fast_sweep)(int); ! 83: int (*poll)(int); ! 84: nw_result (*send)(nw_ep, nw_tx_header_t, nw_options); ! 85: nw_buffer_t (*rpc)(nw_ep, nw_tx_header_t, nw_options); ! 86: void (*signal)(nw_buffer_t); ! 87: nw_result (*open)(nw_ep, nw_address_1, nw_address_2, nw_ep); ! 88: nw_result (*accept)(nw_ep, nw_buffer_t, nw_ep_t); ! 89: nw_result (*close)(nw_ep); ! 90: nw_result (*add)(nw_ep, nw_address_1, nw_address_2, nw_ep); ! 91: nw_result (*drop)(nw_ep, nw_address_1, nw_address_2, nw_ep); ! 92: } nw_dev_entry_s, *nw_dev_entry_t; ! 93: ! 94: typedef struct { ! 95: nw_result status; ! 96: nw_dev_type type; ! 97: char *addr; ! 98: nw_address_1 local_addr_1; ! 99: nw_address_2 local_addr_2; ! 100: nw_dev_entry_t entry; ! 101: int fast_req; ! 102: } nw_devcb; ! 103: ! 104: extern nw_devcb devct[MAX_DEV]; ! 105: ! 106: typedef struct plists { ! 107: nw_peer_s peer; ! 108: struct plists *next; ! 109: } nw_plist_s, *nw_plist_t; ! 110: ! 111: typedef struct nw_unused_buffers { ! 112: u_int buf_used:1; ! 113: u_int buf_length:31; ! 114: struct nw_unused_buffers *next; ! 115: struct nw_unused_buffers *previous; ! 116: } nw_unused_buffer_s, *nw_unused_buffer_t; ! 117: ! 118: typedef struct ecbs{ ! 119: nw_protocol protocol; ! 120: nw_acceptance accept; ! 121: nw_state state; ! 122: nw_plist_t conn; ! 123: char *buf_start; ! 124: char *buf_end; ! 125: nw_unused_buffer_t free_buffer; ! 126: nw_ep id:16; ! 127: u_int overrun:1; ! 128: u_int seqno:14; ! 129: nw_tx_header_t tx_first; ! 130: nw_tx_header_t tx_last; ! 131: nw_tx_header_t tx_initial; ! 132: nw_tx_header_t tx_current; ! 133: nw_rx_header_t rx_first; ! 134: nw_rx_header_t rx_last; ! 135: nw_ep next:16; ! 136: nw_ep previous:16; ! 137: } nw_ecb, *nw_ecb_t; ! 138: ! 139: extern nw_ecb ect[MAX_EP]; ! 140: ! 141: extern int nw_free_ep_first, nw_free_ep_last; ! 142: extern int nw_free_line_first, nw_free_line_last; ! 143: ! 144: typedef enum { ! 145: NW_RECEIVE, ! 146: NW_RECEIVE_URGENT, ! 147: NW_SEND, ! 148: NW_SIGNAL ! 149: } nw_delivery; ! 150: ! 151: ! 152: /*** System-independent functions implemented in core ***/ ! 153: ! 154: extern void nc_initialize(); ! 155: ! 156: extern nw_tx_header_t nc_tx_header_allocate(); ! 157: ! 158: extern void nc_tx_header_deallocate(nw_tx_header_t header); ! 159: ! 160: extern nw_rx_header_t nc_rx_header_allocate(); ! 161: ! 162: extern void nc_rx_header_deallocate(nw_rx_header_t header); ! 163: ! 164: extern nw_plist_t nc_peer_allocate(); ! 165: ! 166: extern void nc_peer_deallocate(nw_plist_t peer); ! 167: ! 168: extern nw_result nc_device_register(u_int dev, nw_dev_type type, ! 169: char *dev_addr, ! 170: nw_dev_entry_t dev_entry_table); ! 171: ! 172: extern nw_result nc_device_unregister(u_int dev, nw_result status); ! 173: ! 174: extern void nc_fast_sweep(); ! 175: ! 176: extern void nc_fast_timer_set(); ! 177: ! 178: extern void nc_fast_timer_reset(); ! 179: ! 180: extern void nc_slow_sweep(); ! 181: ! 182: extern nw_result nc_update(nw_update_type up_type, int *up_info); ! 183: ! 184: extern nw_result nc_lookup(nw_lookup_type lt, int *look_info); ! 185: ! 186: extern nw_result nc_line_update(nw_peer_t peer, nw_ep line); ! 187: ! 188: extern nw_ep nc_line_lookup(nw_peer_t peer); ! 189: ! 190: extern nw_result nc_endpoint_allocate(nw_ep_t epp, nw_protocol protocol, ! 191: nw_acceptance accept, ! 192: char *buffer_address, u_int buffer_size); ! 193: ! 194: extern nw_result nc_endpoint_deallocate(nw_ep ep); ! 195: ! 196: extern nw_buffer_t nc_buffer_allocate(nw_ep ep, u_int size); ! 197: ! 198: extern nw_result nc_buffer_deallocate(nw_ep ep, nw_buffer_t buffer); ! 199: ! 200: extern nw_result nc_endpoint_status(nw_ep ep, ! 201: nw_state_t state, nw_peer_t peer); ! 202: ! 203: ! 204: /* System-dependent function implemented in wrapper*/ ! 205: ! 206: extern boolean_t nc_deliver_result(nw_ep ep, nw_delivery type, int result); ! 207: ! 208: /* Support required in wrapper */ ! 209: ! 210: extern void h_initialize(); ! 211: ! 212: extern void h_fast_timer_set(); ! 213: ! 214: extern void h_fast_timer_reset(); ! 215: ! 216: ! 217: /* Stubs for device table */ ! 218: ! 219: extern nw_result nc_succeed(int); ! 220: extern nw_result nc_fail(int); ! 221: extern void nc_null(int); ! 222: extern int nc_null_poll(int); ! 223: extern nw_result nc_null_send(nw_ep, nw_tx_header_t, nw_options); ! 224: extern nw_buffer_t nc_null_rpc(nw_ep, nw_tx_header_t, nw_options); ! 225: extern nw_result nc_local_send(nw_ep, nw_tx_header_t, nw_options); ! 226: extern nw_buffer_t nc_local_rpc(nw_ep, nw_tx_header_t, nw_options); ! 227: extern void nc_null_signal(nw_buffer_t); ! 228: extern nw_result nc_open_fail(nw_ep, nw_address_1, nw_address_2, nw_ep); ! 229: extern nw_result nc_accept_fail(nw_ep, nw_buffer_t, nw_ep_t); ! 230: extern nw_result nc_close_fail(nw_ep); ! 231: ! 232: #endif /* _NC_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.