1: /*
   2:  *	@(#)raw_hy.c	7.1	6/5/86
   3:  *
   4:  * 4.3 BSD Unix kernel - NSC HYPERchannel support
   5:  *
   6:  * $Header: raw_hy.c,v 3.1 84/02/15 04:27:44 steveg Exp $
   7:  * $Locker:  $
   8:  *
   9:  * Copyright (c) 1984, Tektronix Inc.
  10:  * All Rights Reserved
  11:  *
  12:  */
  13: 
  14: #include "hy.h"
  15: #if NHY > 0
  16: 
  17: #include "param.h"
  18: #include "mbuf.h"
  19: #include "socket.h"
  20: #include "protosw.h"
  21: #include "socketvar.h"
  22: #include "errno.h"
  23: 
  24: #include "../net/if.h"
  25: #include "../net/route.h"
  26: #include "../net/raw_cb.h"
  27: 
  28: #include "../netinet/in.h"
  29: #include "../netinet/in_systm.h"
  30: #include "../netinet/in_var.h"
  31: #include "if_hy.h"
  32: 
  33: /*
  34:  * Raw interface to HYPERchannel.
  35:  */
  36: 
  37: /*
  38:  * Generate HYPERchannel leader and pass packet to hyoutput.
  39:  * The user must create a skeletal leader in order to
  40:  * communicate message type, message subtype, etc.
  41:  * We don't really check the header supplied by the user.
  42:  */
  43: rhy_output(m, so)
  44:     register struct mbuf *m;
  45:     struct socket *so;
  46: {
  47:     int error = 0;
  48:     register struct sockaddr_in *sin;
  49:     register struct rawcb *rp = sotorawcb(so);
  50:     struct in_ifaddr *ia;
  51: 
  52:     /*
  53: 	 * Verify user has supplied necessary space
  54: 	 * for the header.
  55: 	 */
  56:     if ((m->m_off > MMAXOFF || m->m_len < sizeof(struct hym_hdr)) &&
  57:         (m = m_pullup(m, sizeof(struct hym_hdr))) == 0) {
  58:         error = EMSGSIZE;   /* XXX */
  59:         goto bad;
  60:     }
  61: 
  62:     sin = (struct sockaddr_in *)&rp->rcb_faddr;
  63:     /* no routing here */
  64:     ia = in_iaonnetof(in_netof(sin->sin_addr));
  65:     if (ia)
  66:         return (hyoutput(ia->ia_ifp, m, (struct sockaddr *)sin));
  67:     error = ENETUNREACH;
  68: bad:
  69:     m_freem(m);
  70:     return (error);
  71: }
  72: #endif

Defined functions

rhy_output defined in line 43; used 2 times
Last modified: 1986-06-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1050
Valid CSS Valid XHTML 1.0 Strict