|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1988 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * This code is derived from software contributed to Berkeley by ! 6: * Tektronix Inc. ! 7: * ! 8: * Redistribution is only permitted until one year after the first shipment ! 9: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 10: * binary forms are permitted provided that: (1) source distributions retain ! 11: * this entire copyright notice and comment, and (2) distributions including ! 12: * binaries display the following acknowledgement: This product includes ! 13: * software developed by the University of California, Berkeley and its ! 14: * contributors'' in the documentation or other materials provided with the ! 15: * distribution and in all advertising materials mentioning features or use ! 16: * of this software. Neither the name of the University nor the names of ! 17: * its contributors may be used to endorse or promote products derived from ! 18: * this software without specific prior written permission. ! 19: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 20: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 21: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 22: * ! 23: * @(#)raw_hy.c 7.3 (Berkeley) 6/28/90 ! 24: */ ! 25: ! 26: /* ! 27: * 4.3 BSD Unix kernel - NSC HYPERchannel support ! 28: * ! 29: * $Header: raw_hy.c,v 3.1 84/02/15 04:27:44 steveg Exp $ ! 30: * $Locker: $ ! 31: * ! 32: * Copyright (c) 1984, Tektronix Inc. ! 33: * All Rights Reserved ! 34: * ! 35: */ ! 36: ! 37: #include "hy.h" ! 38: #if NHY > 0 ! 39: ! 40: #include "param.h" ! 41: #include "mbuf.h" ! 42: #include "socket.h" ! 43: #include "protosw.h" ! 44: #include "socketvar.h" ! 45: #include "errno.h" ! 46: ! 47: #include "../net/if.h" ! 48: #include "../net/route.h" ! 49: #include "../net/raw_cb.h" ! 50: ! 51: #include "../netinet/in.h" ! 52: #include "../netinet/in_systm.h" ! 53: #include "../netinet/in_var.h" ! 54: #include "if_hy.h" ! 55: ! 56: /* ! 57: * Raw interface to HYPERchannel. ! 58: */ ! 59: ! 60: /* ! 61: * Generate HYPERchannel leader and pass packet to hyoutput. ! 62: * The user must create a skeletal leader in order to ! 63: * communicate message type, message subtype, etc. ! 64: * We don't really check the header supplied by the user. ! 65: */ ! 66: rhy_output(m, so) ! 67: register struct mbuf *m; ! 68: struct socket *so; ! 69: { ! 70: int error = 0; ! 71: register struct sockaddr_in *sin; ! 72: register struct rawcb *rp = sotorawcb(so); ! 73: struct in_ifaddr *ia; ! 74: ! 75: /* ! 76: * Verify user has supplied necessary space ! 77: * for the header. ! 78: */ ! 79: if ((m->m_off > MMAXOFF || m->m_len < sizeof(struct hym_hdr)) && ! 80: (m = m_pullup(m, sizeof(struct hym_hdr))) == 0) { ! 81: error = EMSGSIZE; /* XXX */ ! 82: goto bad; ! 83: } ! 84: ! 85: sin = (struct sockaddr_in *)&rp->rcb_faddr; ! 86: /* no routing here */ ! 87: ia = in_iaonnetof(in_netof(sin->sin_addr)); ! 88: if (ia) ! 89: return (hyoutput(ia->ia_ifp, m, (struct sockaddr *)sin)); ! 90: error = ENETUNREACH; ! 91: bad: ! 92: m_freem(m); ! 93: return (error); ! 94: } ! 95: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.