Ejemplo n.º 1
0
static int
ddp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
            struct mbuf *control, struct proc *p)
{
	struct ddpcb	*ddp;
	int		error = 0;
	int		s;
	
	ddp = sotoddpcb( so );
	if ( ddp == NULL ) {
		return(EINVAL);
	}

    	if ( control && control->m_len ) {
		return(EINVAL);
    	}

	if ( addr ) {
		if ( ddp->ddp_fsat.sat_port != ATADDR_ANYPORT ) {
			return(EISCONN);
		}

		s = splnet();
		error = at_pcbconnect(ddp, addr, p);
		splx( s );
		if ( error ) {
			return(error);
		}
	} else {
		if ( ddp->ddp_fsat.sat_port == ATADDR_ANYPORT ) {
			return(ENOTCONN);
		}
	}

	s = splnet();
	error = ddp_output( m, so );
	if ( addr ) {
	    at_pcbdisconnect( ddp );
	}
	splx(s);
	return(error);
}
Ejemplo n.º 2
0
static int
ddp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
    struct mbuf *control, struct thread *td)
{
	struct ddpcb *ddp;
	int error = 0;
	
	ddp = sotoddpcb(so);
	KASSERT(ddp != NULL, ("ddp_send: ddp == NULL"));

    	if (control && control->m_len)
		return (EINVAL);

	if (addr != NULL) {
		DDP_LIST_XLOCK();
		DDP_LOCK(ddp);
		if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT) {
			error = EISCONN;
			goto out;
		}

		error = at_pcbconnect(ddp, addr, td);
		if (error == 0) {
			error = ddp_output(m, so);
			at_pcbdisconnect(ddp);
		}
out:
		DDP_UNLOCK(ddp);
		DDP_LIST_XUNLOCK();
	} else {
		DDP_LOCK(ddp);
		if (ddp->ddp_fsat.sat_port == ATADDR_ANYPORT)
			error = ENOTCONN;
		else
			error = ddp_output(m, so);
		DDP_UNLOCK(ddp);
	}
	return (error);
}
Ejemplo n.º 3
0
static int
ddp_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
{
	struct ddpcb	*ddp;
	int		error = 0;
	int		s;
	
	ddp = sotoddpcb( so );
	if ( ddp == NULL ) {
	    return( EINVAL);
	}

	if ( ddp->ddp_fsat.sat_port != ATADDR_ANYPORT ) {
	    return(EISCONN);
	}

	s = splnet();
	error = at_pcbconnect( ddp, nam, p );
	splx(s);
	if ( error == 0 )
	    soisconnected( so );
	return(error);
}
Ejemplo n.º 4
0
static int
ddp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
{
	struct ddpcb *ddp;
	int error = 0;
	
	ddp = sotoddpcb(so);
	KASSERT(ddp != NULL, ("ddp_connect: ddp == NULL"));

	DDP_LIST_XLOCK();
	DDP_LOCK(ddp);
	if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT) {
		DDP_UNLOCK(ddp);
		DDP_LIST_XUNLOCK();
		return (EISCONN);
	}

	error = at_pcbconnect( ddp, nam, td );
	DDP_UNLOCK(ddp);
	DDP_LIST_XUNLOCK();
	if (error == 0)
		soisconnected(so);
	return (error);
}