Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

vipconnectreject.c

Go to the documentation of this file.
00001 /********************************************************
00002  * Myricom VI-GM  networking software and documentation *
00003  * Copyright (c) 2001 by Myricom, Inc.                  *
00004  * All rights reserved.                                 *
00005  * See the file `COPYING' for copyright notice.         *
00006  ********************************************************/
00007 
00013 #include "vipl_priv.h"
00014 
00015 
00037 VIP_ENTRY_POINT VIP_RETURN
00038 VipConnectReject (VIP_CONN_HANDLE ConnHandle)
00039 {
00040   VIP_GM *vip_gm_ptr;
00041   VIP_NIC *vip_nic_ptr;
00042   VIP_CONN *vip_conn_ptr;
00043   VIP_SEND_REQ *vip_send_req_ptr;
00044   VIP_PACKET_CONN_REJECT *pkt_ptr;
00045   VIP_DEBUG_LABEL (("VipConnectAccept"));
00046 
00047   /* check conn handle */
00048   vip_conn_ptr = (VIP_CONN *) ConnHandle;
00049   if (VIP_INVALID_CONN_HANDLE (vip_conn_ptr))
00050     {
00051       VIP_DEBUG (("Invalid CONN handle"));
00052       return VIP_INVALID_PARAMETER;
00053     }
00054   vip_nic_ptr = vip_conn_ptr->handle.vip_nic_ptr;
00055   vip_gm_ptr = vip_nic_ptr->vip_gm_ptr;
00056   VIP_MUTEX_LOCK (&(vip_gm_ptr->lock));
00057   VIP_PROGRESSION (vip_gm_ptr);
00058   VIP_MUTEX_LOCK (&(vip_nic_ptr->lock));
00059 
00060   /* allocate a send buffer */
00061   vip_send_req_ptr =
00062     vip_allocate_packet (vip_gm_ptr, sizeof (VIP_PACKET_CONN_REJECT));
00063   if (vip_send_req_ptr == NULL)
00064     {
00065       VIP_MUTEX_UNLOCK (&(vip_nic_ptr->lock));
00066       VIP_MUTEX_UNLOCK (&(vip_gm_ptr->lock));
00067       return VIP_ERROR_RESOURCE;
00068     }
00069 
00070   /* fill the packet and send it */
00071   pkt_ptr = (VIP_PACKET_CONN_REJECT *) (vip_send_req_ptr->ptr);
00072   pkt_ptr->type = VIP_HTON_UCHAR (VIP_CONN_REJECT_PKT);
00073   pkt_ptr->clt_seq_num = vip_conn_ptr->net_remote_seq_num;
00074   pkt_ptr->clt_conn_ptr = vip_conn_ptr->net_remote_conn_ptr;
00075 
00076   vip_send_req_ptr->type |= VIP_SEND_REQ_RELIABLE;
00077   vip_send_req_ptr->dest_port_id = vip_conn_ptr->remote_port_id;
00078   vip_send_req_ptr->dest_gm_id = vip_conn_ptr->remote_gm_id;
00079   vip_send_req_ptr->vip_nic_ptr = vip_nic_ptr;
00080   vip_send_data (vip_send_req_ptr);
00081 
00082   vip_free_handle (&(vip_nic_ptr->vip_conn_set), (VIP_HANDLE *) vip_conn_ptr);
00083   VIP_MUTEX_UNLOCK (&(vip_nic_ptr->lock));
00084   VIP_MUTEX_UNLOCK (&(vip_gm_ptr->lock));
00085   return VIP_SUCCESS;
00086 }
VI-GM-1.3 by Myricom © 1997-2006. Documentation generated on 20 May 2006 by doxygen 1.4.4.