/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
- *
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* Please see the License for the specific language governing rights and
* limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1998 Apple Computer, Inc.
#include <net/if.h>
+#include <netat/sysglue.h>
#include <netat/appletalk.h>
+#include <netat/at_pcb.h>
#include <netat/at_var.h>
-#include <netat/sysglue.h>
#include <netat/ddp.h>
#include <netat/ep.h>
#include <netat/rtmp.h>
#include <netat/zip.h>
-#include <netat/at_pcb.h>
#include <netat/routing_tables.h>
#include <netat/nbp.h>
-extern int at_control(), at_memzone_init();
-extern void nbp_input(), ep_input(), zip_router_input(),
- sip_input(), add_ddp_handler(), init_ddp_handler(),
- ddp_start(), ddp_input(), appletalk_hack_start();
-extern u_short ddp_checksum();
-extern at_ifaddr_t *forUs();
-extern struct mbuf *m_dup(struct mbuf *, int);
extern at_ifaddr_t *ifID_home;
extern int xpatcnt;
ddp_recvspace = 50 * (600 + sizeof(struct sockaddr_at));
int ddp_pru_control(struct socket *so, u_long cmd, caddr_t data,
- struct ifnet *ifp, struct proc *p)
+ struct ifnet *ifp, __unused struct proc *p)
{
return(at_control(so, cmd, data, ifp));
}
int ddp_pru_attach(struct socket *so, int proto,
- struct proc *p)
+ __unused struct proc *p)
{
- int s, error = 0;
- at_ddp_t *ddp = NULL;
+ int error = 0;
struct atpcb *pcb = (struct atpcb *)((so)->so_pcb);
- s = splnet();
+ error = soreserve(so, ddp_sendspace, ddp_recvspace);
+ if (error != 0)
+ return error;
+
error = at_pcballoc(so, &ddp_head);
- splx(s);
if (error)
return error;
- error = soreserve(so, ddp_sendspace, ddp_recvspace);
pcb = (struct atpcb *)((so)->so_pcb);
- pcb->pid = current_proc()->p_pid;
+ pcb->pid = proc_selfpid();
pcb->ddptype = (u_char) proto; /* set in socreate() */
pcb->proto = ATPROTO_DDP;
int ddp_pru_disconnect(struct socket *so)
{
- int s, error = 0;
- at_ddp_t *ddp = NULL;
+ int error = 0;
struct atpcb *pcb = (struct atpcb *)((so)->so_pcb);
if (pcb == NULL)
return ENOTCONN;
soisdisconnected(so);
- s = splnet();
at_pcbdetach(pcb);
- splx(s);
return error;
}
int ddp_pru_abort(struct socket *so)
{
- int s;
struct atpcb *pcb = (struct atpcb *)((so)->so_pcb);
if (pcb == NULL)
return (EINVAL);
soisdisconnected(so);
- s = splnet();
at_pcbdetach(pcb);
- splx(s);
return 0;
}
int ddp_pru_detach(struct socket *so)
{
- int s;
struct atpcb *pcb = (struct atpcb *)((so)->so_pcb);
if (pcb == NULL)
return (EINVAL);
- s = splnet();
at_pcbdetach(pcb);
- splx(s);
return 0;
}
int ddp_pru_bind(struct socket *so, struct sockaddr *nam,
- struct proc *p)
+ __unused struct proc *p)
{
struct atpcb *pcb = (struct atpcb *)((so)->so_pcb);
}
-int ddp_pru_send(struct socket *so, int flags, struct mbuf *m,
- struct sockaddr *addr, struct mbuf *control,
- struct proc *p)
+int ddp_pru_send(struct socket *so, __unused int flags, struct mbuf *m,
+ struct sockaddr *addr, __unused struct mbuf *control,
+ __unused struct proc *p)
{
at_ddp_t *ddp = NULL;
struct atpcb *pcb = (struct atpcb *)((so)->so_pcb);
}
}
if (ddp) {
- ddp->length = m->m_pkthdr.len;
- UAS_ASSIGN(ddp->checksum,
+ DDPLEN_ASSIGN(ddp, m->m_pkthdr.len);
+ UAS_ASSIGN_HTON(ddp->checksum,
(pcb->ddp_flags & DDPFLG_CHKSUM)? 1: 0);
ddp->type = (pcb->ddptype)? pcb->ddptype: DEFAULT_OT_DDPTYPE;
#ifdef NOT_YET
NET_ASSIGN(ddp->src_net, ifID->ifThisNode.s_net);
ddp->src_node = ifID->ifThisNode.s_node;
ddp->src_socket = pcb->lport;
- if (UAS_VALUE(ddp->checksum))
- UAS_ASSIGN(ddp->checksum, ddp_checksum(m, 4));
+ if (UAS_VALUE_NTOH(ddp->checksum))
+ UAS_ASSIGN_HTON(ddp->checksum, ddp_checksum(m, 4));
ddp_input(n, ifID);
}
}
int ddp_pru_sockaddr(struct socket *so,
struct sockaddr **nam)
{
- int s;
struct atpcb *pcb;
struct sockaddr_at *sat;
return(ENOMEM);
bzero((caddr_t)sat, sizeof(*sat));
- s = splnet();
if ((pcb = sotoatpcb(so)) == NULL) {
- splx(s);
FREE(sat, M_SONAME);
return(EINVAL);
}
sat->sat_len = sizeof(*sat);
sat->sat_port = pcb->lport;
sat->sat_addr = pcb->laddr;
- splx(s);
*nam = (struct sockaddr *)sat;
return(0);
int ddp_pru_peeraddr(struct socket *so,
struct sockaddr **nam)
{
- int s;
struct atpcb *pcb;
struct sockaddr_at *sat;
return (ENOMEM);
bzero((caddr_t)sat, sizeof(*sat));
- s = splnet();
if ((pcb = sotoatpcb(so)) == NULL) {
- splx(s);
FREE(sat, M_SONAME);
return(EINVAL);
}
sat->sat_len = sizeof(*sat);
sat->sat_port = pcb->rport;
sat->sat_addr = pcb->raddr;
- splx(s);
*nam = (struct sockaddr *)sat;
return(0);
}
-int ddp_pru_connect(struct socket *so, struct sockaddr *nam,
- struct proc *p)
+int ddp_pru_connect(struct socket *so, struct sockaddr *nam,
+ __unused struct proc *p)
{
struct atpcb *pcb = (struct atpcb *)((so)->so_pcb);
struct sockaddr_at *faddr = (struct sockaddr_at *) nam;
}
-
/*
* One-time AppleTalk initialization
*/
appletalk_hack_start();
} /* ddp_init */
-