Annotation of Gnu-Mach/device/net_io.h, revision 1.1.1.4

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: 
1.1.1.4 ! root       49: struct net_rcv_port;
        !            50: typedef struct net_rcv_port *net_rcv_port_t;
        !            51: 
        !            52: struct net_hash_entry;
        !            53: typedef struct net_hash_entry *net_hash_entry_t;
        !            54: 
        !            55: struct net_hash_header;
        !            56: typedef struct net_hash_header *net_hash_header_t;
        !            57: 
1.1       root       58: /*
                     59:  * A network packet is wrapped in a kernel message while in
                     60:  * the kernel.
                     61:  */
                     62: 
                     63: #define        net_kmsg(kmsg)  ((net_rcv_msg_t)&(kmsg)->ikm_header)
                     64: 
                     65: /*
                     66:  * Interrupt routines may allocate and free net_kmsgs with these
                     67:  * functions.  net_kmsg_get may return IKM_NULL.
                     68:  */
                     69: 
1.1.1.3   root       70: extern ipc_kmsg_t net_kmsg_get(void);
                     71: extern void net_kmsg_put(ipc_kmsg_t);
1.1       root       72: 
                     73: /*
                     74:  * Network utility routines.
                     75:  */
                     76: 
1.1.1.4 ! root       77: extern void net_ast(void);
1.1.1.3   root       78: extern void net_packet(struct ifnet *, ipc_kmsg_t, unsigned int, boolean_t);
                     79: extern void net_filter(ipc_kmsg_t, ipc_kmsg_queue_t);
                     80: extern io_return_t net_getstat(struct ifnet *, dev_flavor_t, dev_status_t,
                     81:                               natural_t *);
                     82: extern io_return_t net_write(struct ifnet *, int (*)(), io_req_t);
1.1       root       83: 
                     84: /*
                     85:  * Non-interrupt code may allocate and free net_kmsgs with these functions.
                     86:  */
                     87: 
                     88: extern vm_size_t net_kmsg_size;
                     89: 
1.1.1.3   root       90: extern void net_kmsg_collect (void);
                     91: 
1.1.1.4 ! root       92: extern void net_io_init(void);
        !            93: extern void net_thread(void) __attribute__ ((noreturn));
        !            94: 
1.1       root       95: #define net_kmsg_alloc()       ((ipc_kmsg_t) kalloc(net_kmsg_size))
                     96: #define net_kmsg_free(kmsg)    kfree((vm_offset_t) (kmsg), net_kmsg_size)
                     97: 
1.1.1.3   root       98: extern unsigned int            ntohl(unsigned int);
                     99: extern unsigned short int      ntohs(unsigned short int);
                    100: extern unsigned int            htonl(unsigned int);
                    101: extern unsigned short int      htons(unsigned short int);
                    102: 
1.1.1.4 ! root      103: unsigned int bpf_hash(int n, const unsigned int *keys);
        !           104: 
        !           105: extern boolean_t
        !           106: net_do_filter(
        !           107:        net_rcv_port_t  infp,
        !           108:        const char *    data,
        !           109:        unsigned int    data_count,
        !           110:        const char *    header); /* CSPF */
        !           111: 
        !           112: extern int
        !           113: bpf_do_filter(
        !           114:        net_rcv_port_t          infp,
        !           115:        char *                  p,
        !           116:        unsigned int            wirelen,
        !           117:        char *                  header,
        !           118:        unsigned int            hlen,
        !           119:        net_hash_entry_t        **hash_headpp,
        !           120:        net_hash_entry_t        *entpp); /* BPF */
        !           121: 
        !           122: int hash_ent_remove(
        !           123:        struct ifnet            *ifp,
        !           124:        net_hash_header_t       hp,
        !           125:        int                     used,
        !           126:        net_hash_entry_t        *head,
        !           127:        net_hash_entry_t        entp,
        !           128:        queue_entry_t           *dead_p);
        !           129: 
        !           130: void net_free_dead_infp(queue_entry_t dead_infp);
        !           131: void net_free_dead_entp (queue_entry_t dead_entp);
        !           132: 
        !           133: int bpf_validate(
        !           134:        bpf_insn_t      f,
        !           135:        int             bytes,
        !           136:        bpf_insn_t      *match);
        !           137: 
        !           138: int bpf_eq(
        !           139:        bpf_insn_t      f1,
        !           140:        bpf_insn_t      f2,
        !           141:        int             bytes);
        !           142: 
        !           143: int net_add_q_info(ipc_port_t rcv_port);
        !           144: 
        !           145: int bpf_match (
        !           146:        net_hash_header_t       hash,
        !           147:        int                     n_keys,
        !           148:        const unsigned int      *keys,
        !           149:        net_hash_entry_t        **hash_headpp,
        !           150:        net_hash_entry_t        *entpp);
        !           151: 
1.1.1.2   root      152: #endif /* _DEVICE_NET_IO_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.