include file for per-architecture Makefiles
[unix-history] / usr / src / sys / netiso / cltp_usrreq.c
index b1bc886..01f56f6 100644 (file)
@@ -2,24 +2,13 @@
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  *
  *
- *     @(#)cltp_usrreq.c       7.2 (Berkeley) %G%
+ *     @(#)cltp_usrreq.c       7.8 (Berkeley) %G%
  */
 
 #ifndef CLTPOVAL_SRC /* XXX -- till files gets changed */
 #include "param.h"
  */
 
 #ifndef CLTPOVAL_SRC /* XXX -- till files gets changed */
 #include "param.h"
-#include "user.h"
 #include "malloc.h"
 #include "mbuf.h"
 #include "protosw.h"
 #include "malloc.h"
 #include "mbuf.h"
 #include "protosw.h"
@@ -234,34 +223,25 @@ bad:
        return (error);
 }
 
        return (error);
 }
 
-#ifndef TP_LOCAL
-/* XXXX should go in iso.h maybe? from tp_param.h, in any case */
-#define                TP_LOCAL                                22
-#define                TP_FOREIGN                              33
-#endif
-
 u_long cltp_sendspace = 9216;          /* really max datagram size */
 u_long cltp_recvspace = 40 * (1024 + sizeof(struct sockaddr_iso));
                                        /* 40 1K datagrams */
 
 
 /*ARGSUSED*/
 u_long cltp_sendspace = 9216;          /* really max datagram size */
 u_long cltp_recvspace = 40 * (1024 + sizeof(struct sockaddr_iso));
                                        /* 40 1K datagrams */
 
 
 /*ARGSUSED*/
-cltp_usrreq(so, req, m, nam, rights, control)
+cltp_usrreq(so, req, m, nam, control)
        struct socket *so;
        int req;
        struct socket *so;
        int req;
-       struct mbuf *m, *nam, *rights, *control;
+       struct mbuf *m, *nam, *control;
 {
 {
-       struct isopcb *isop = sotoisopcb(so);
+       register struct isopcb *isop = sotoisopcb(so);
        int s, error = 0;
 
        if (req == PRU_CONTROL)
                return (iso_control(so, (int)m, (caddr_t)nam,
        int s, error = 0;
 
        if (req == PRU_CONTROL)
                return (iso_control(so, (int)m, (caddr_t)nam,
-                       (struct ifnet *)rights));
-       if (rights && rights->m_len) {
-               error = EINVAL;
-               goto release;
-       }
-       if (isop == NULL && req != PRU_ATTACH) {
+                       (struct ifnet *)control));
+       if ((isop == NULL && req != PRU_ATTACH) ||
+           (control && control->m_len)) {
                error = EINVAL;
                goto release;
        }
                error = EINVAL;
                goto release;
        }
@@ -358,11 +338,15 @@ cltp_usrreq(so, req, m, nam, rights, control)
                break;
 
        case PRU_SOCKADDR:
                break;
 
        case PRU_SOCKADDR:
-               iso_getnetaddr(isop, nam, TP_LOCAL);
+               if (isop->isop_laddr)
+                       bcopy((caddr_t)isop->isop_laddr, mtod(m, caddr_t),
+                               nam->m_len = isop->isop_laddr->siso_len);
                break;
 
        case PRU_PEERADDR:
                break;
 
        case PRU_PEERADDR:
-               iso_getnetaddr(isop, nam, TP_FOREIGN);
+               if (isop->isop_faddr)
+                       bcopy((caddr_t)isop->isop_faddr, mtod(m, caddr_t),
+                               nam->m_len = isop->isop_faddr->siso_len);
                break;
 
        case PRU_SENSE:
                break;
 
        case PRU_SENSE:
@@ -387,6 +371,8 @@ cltp_usrreq(so, req, m, nam, rights, control)
                panic("cltp_usrreq");
        }
 release:
                panic("cltp_usrreq");
        }
 release:
+       if (control != NULL)
+               m_freem(control);
        if (m != NULL)
                m_freem(m);
        return (error);
        if (m != NULL)
                m_freem(m);
        return (error);