/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* MODULE: dapl_cr_accept.c
*
* PURPOSE: Connection management
* Description: Interfaces in this file are completely described in
* the DAPL 1.1 API, Chapter 6, section 4
*
* $Id: dapl_cr_accept.c,v 1.21 2003/08/08 19:20:05 sjs2 Exp $
*/
#include "dapl.h"
#include "dapl_adapter_util.h"
/*
* dapl_cr_accept
*
* DAPL Requirements Version xxx, 6.4.2.1
*
* Establish a connection between active remote side requesting Endpoint
* and passic side local Endpoint.
*
* Input:
* cr_handle
* ep_handle
* private_data_size
* private_data
*
* Output:
* none
*
* Returns:
* DAT_SUCCESS
* DAT_INVALID_PARAMETER
* DAT_INVALID_ATTRIBUTE
*/
{
"dapl_cr_accept(%p, %p, %d, %p)\n",
goto bail;
}
/*
* Return an error if we have an ep_handle and the CR already has an
* EP, indicating this is an RSP connection or PSP_PROVIDER_FLAG was
* specified.
*/
goto bail;
}
goto bail;
}
/*
* Verify the private data size doesn't exceed the max
*/
goto bail;
}
/*
* ep_handle is NULL if the user specified DAT_PSP_PROVIDER_FLAG
* OR this is an RSP connection; retrieve it from the cr.
*/
return (DAT_INVALID_STATE);
}
} else {
/* ensure this EP isn't connected or in use */
return (DAT_INVALID_STATE);
}
}
/*
* Verify the attributes of the EP handle before we connect it. Test
* all of the handles to make sure they are currently valid.
* Specifically:
* pz_handle required
* recv_evd_handle optional, but must be valid
* request_evd_handle optional, but must be valid
* connect_evd_handle required
* We do all verification and state change under lock, at which
* point the EP state should protect us from most races.
*/
DAPL_MAGIC_EVD)))) {
goto bail;
}
/*
* If we are lazy attaching the QP then we may need to
* hook it up here. Typically, we run this code only for
* DAT_PSP_PROVIDER_FLAG
*/
ep_ptr);
if (dat_status != DAT_SUCCESS) {
/* This is not a great error code, but spec allows */
goto bail;
}
}
/*
* private data
*/
sizeof (DAPL_PRIVATE) - private_data_size);
/*
* If the provider failed, unwind the damage so we are back at
* the initial state.
*/
if (dat_status != DAT_SUCCESS) {
} else {
/*
* Make this CR invalid. We need to hang on to it until
* the connection terminates, but it's destroyed from
* the app point of view.
*/
}
bail:
return (dat_status);
}