|
|
1.1 root 1: /*
2: * Copyright (c) 1996-1994 The University of Utah and
3: * the Computer Systems Laboratory (CSL). All rights reserved.
4: *
5: * Permission to use, copy, modify and distribute this software is hereby
6: * granted provided that (1) source code retains these copyright, permission,
7: * and disclaimer notices, and (2) redistributions including binaries
8: * reproduce the notices in supporting documentation, and (3) all advertising
9: * materials mentioning features or use of this software display the following
10: * acknowledgement: ``This product includes software developed by the
11: * Computer Systems Laboratory at the University of Utah.''
12: *
13: * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
14: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
15: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16: *
17: * CSL requests users of this software to return to [email protected] any
18: * improvements that they make and grant CSL redistribution rights.
19: *
20: * Utah $Hdr: fipc.h 1.1 96/2/29$
21: * Author: Linus Kamb
22: */
23:
24: #include <kern/lock.h>
25: #include <device/if_ether.h>
26:
27:
28: #define N_MAX_OPEN_FIPC_PORTS 32 /* In practice,
29: * this should be much larger */
30: #define MAX_FIPC_PORT_NUM 4095 /* ditto */
31:
32: #define FIPC_MSG_TYPE 0x1234
33:
34: #define FIPC_BUFFER_SIZE ETHERMTU
35: #define FIPC_MSG_SIZE (FIPC_BUFFER_SIZE - sizeof(fipc_header_t))
36:
37: #define FIPC_RECV_Q_SIZE 4
38: #define N_MIN_RECV_BUFS 5 /* 2 pages worth */
39: #define N_MAX_RECV_BUFS (N_MAX_OPEN_FIPC_PORTS * FIPC_RECV_Q_SIZE)
40: #define N_MIN_SEND_BUFS 2
41: #define N_MAX_SEND_BUFS 5
42:
43: #define INVALID -1
44:
45: #define ETHER_HWADDR_SIZE 6
46: #define ETHER_DEVICE_NAME "ne0"
47:
48: typedef struct fipc_endpoint_structure
49: {
50: unsigned char hwaddr[ETHER_HWADDR_SIZE];
51: unsigned short port;
52: } fipc_endpoint_t;
53:
54: typedef struct fipc_buffer_structure
55: {
56: char *buffer;
57: unsigned short size;
58: fipc_endpoint_t sender;
59: } fipc_buffer_q_ent;
60:
61: typedef struct fipc_port_structure
62: {
63: simple_lock_data_t lock;
64: boolean_t bound;
65: int valid_msg;
66: fipc_buffer_q_ent recv_q[FIPC_RECV_Q_SIZE];
67: int rq_head, rq_tail;
68: } fipc_port_t;
69:
70: typedef struct fipc_header_structure
71: {
72: unsigned short dest_port;
73: unsigned short send_port;
74: unsigned int msg_size;
75: } fipc_header_t;
76:
77: typedef struct fipc_lookup_table_ent_structure
78: {
79: int fipc_port;
80: int fpt_num; /* f_ports[] entry number */
81: } fipc_lookup_table_ent;
82:
83: typedef struct fipc_stat_structure
84: {
85: int dropped_msgs;
86: } fipc_stat_t;
87:
88: #define min(a,b) (((a)<=(b)?(a):(b)))
89:
90: char* get_fipc_buffer(int, boolean_t, boolean_t);
91: void fipc_packet(char*, struct ether_header);
92:
93: extern int fipc_sends;
94: extern int fipc_recvs;
95:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.