checked in for torek by sklower; Mike agrees to all these changes
[unix-history] / usr / src / sys / deprecated / netrmp / rmp.c
CommitLineData
a8fd2d0d
KM
1/*
2 * Copyright (c) 1988 University of Utah.
3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the Systems Programming Group of the University of Utah Computer
8 * Science Department.
9 *
10 * %sccs.include.redist.c%
11 *
12 * from: Utah $Hdr: rmp.c 1.3 89/06/07$
13 *
14 * @(#)rmp.c 7.1 (Berkeley) %G%
15 */
16
17#include "param.h"
18#include "mbuf.h"
19#include "socket.h"
20#include "socketvar.h"
21
22#include "../net/if.h"
23#include "../net/route.h"
24#include "../net/raw_cb.h"
25
26#include "../netrmp/rmp.h"
27#include "../netrmp/rmp_var.h"
28
29/*
30** rmp_output: route packet to proper network interface.
31*/
32
33rmp_output(m, so)
34struct mbuf *m;
35struct socket *so;
36{
37 struct ifnet *ifp;
38 struct rawcb *rp = sotorawcb(so);
39 struct rmp_packet *rmp;
40
41 /*
42 * Convert the mbuf back to an RMP packet so we can get the
43 * address of the "ifnet struct" specifying the interface it
44 * should go out on.
45 */
46 rmp = mtod(m, struct rmp_packet *);
47 ifp = rmp->ifp;
48
49 /*
50 * Strip off the "ifnet struct ptr" from the packet leaving
51 * us with a complete IEEE 802.2 packet.
52 */
53 m_adj(m, sizeof(struct ifnet *));
54
55 /*
56 * Send the packet.
57 */
58 return ((*ifp->if_output) (ifp, m, &rp->rcb_faddr));
59}