|
|
1.1.1.2 root 1: /*
1.1 root 2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4: * All Rights Reserved.
1.1.1.2 root 5: *
1.1 root 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.
1.1.1.2 root 11: *
1.1 root 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.
1.1.1.2 root 15: *
1.1 root 16: * Carnegie Mellon requests users of this software to return to
1.1.1.2 root 17: *
1.1 root 18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
1.1.1.2 root 22: *
1.1 root 23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26: /*
27: * Author: David B. Golub, Carnegie Mellon University
28: * Date: ll/89
29: */
30:
31: #ifndef _DEVICE_NET_IO_H_
32: #define _DEVICE_NET_IO_H_
33:
34: /*
35: * Utilities for playing with network messages.
36: */
37:
38: #include <mach/machine/vm_types.h>
39: #include <ipc/ipc_kmsg.h>
40:
41: #include <kern/macro_help.h>
42: #include <kern/lock.h>
43: #include <kern/kalloc.h>
44:
1.1.1.3 ! root 45: #include <device/if_hdr.h>
! 46: #include <device/io_req.h>
1.1 root 47: #include <device/net_status.h>
48:
49: /*
50: * A network packet is wrapped in a kernel message while in
51: * the kernel.
52: */
53:
54: #define net_kmsg(kmsg) ((net_rcv_msg_t)&(kmsg)->ikm_header)
55:
56: /*
57: * Interrupt routines may allocate and free net_kmsgs with these
58: * functions. net_kmsg_get may return IKM_NULL.
59: */
60:
1.1.1.3 ! root 61: extern ipc_kmsg_t net_kmsg_get(void);
! 62: extern void net_kmsg_put(ipc_kmsg_t);
1.1 root 63:
64: /*
65: * Network utility routines.
66: */
67:
1.1.1.3 ! root 68: extern void net_ast();
! 69: extern void net_packet(struct ifnet *, ipc_kmsg_t, unsigned int, boolean_t);
! 70: extern void net_filter(ipc_kmsg_t, ipc_kmsg_queue_t);
! 71: extern io_return_t net_getstat(struct ifnet *, dev_flavor_t, dev_status_t,
! 72: natural_t *);
! 73: extern io_return_t net_write(struct ifnet *, int (*)(), io_req_t);
1.1 root 74:
75: /*
76: * Non-interrupt code may allocate and free net_kmsgs with these functions.
77: */
78:
79: extern vm_size_t net_kmsg_size;
80:
1.1.1.3 ! root 81: extern void net_kmsg_collect (void);
! 82:
1.1 root 83: #define net_kmsg_alloc() ((ipc_kmsg_t) kalloc(net_kmsg_size))
84: #define net_kmsg_free(kmsg) kfree((vm_offset_t) (kmsg), net_kmsg_size)
85:
1.1.1.3 ! root 86: extern unsigned int ntohl(unsigned int);
! 87: extern unsigned short int ntohs(unsigned short int);
! 88: extern unsigned int htonl(unsigned int);
! 89: extern unsigned short int htons(unsigned short int);
! 90:
1.1.1.2 root 91: #endif /* _DEVICE_NET_IO_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.