/** @file
Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "IScsiImpl.h"
/**
The common notify function associated with various Tcp4Io events.
@param[in] Event The event signaled.
@param[in] Context The context.
**/
)
{
}
/**
Create a TCP socket with the specified configuration data.
@param[in] Image The handle of the driver image.
@param[in] Controller The handle of the controller.
@param[in] ConfigData The Tcp4 configuration data.
@param[in] Tcp4Io The Tcp4Io.
@retval EFI_SUCCESS The TCP socket is created and configured.
@retval Others Failed to create the TCP socket or configure it.
**/
)
{
//
// Create the TCP4 child instance and get the TCP4 protocol.
//
);
return Status;
}
);
goto ON_ERROR;
}
//
// Set the configuration parameters.
//
ControlOption.FinTimeout = 0;
AccessPoint->StationPort = 0;
//
// Configure the TCP4 protocol.
//
goto ON_ERROR;
}
//
// the gateway is not zero, add the default route by hand
//
goto ON_ERROR;
}
}
//
// Create events for variuos asynchronous operations.
//
&Tcp4Io->IsConnDone,
);
goto ON_ERROR;
}
);
goto ON_ERROR;
}
);
goto ON_ERROR;
}
);
goto ON_ERROR;
}
return EFI_SUCCESS;
}
}
}
gBS->CloseProtocol (
);
}
);
return Status;
}
/**
Destroy the socket.
@param[in] Tcp4Io The Tcp4Io which wraps the socket to be destroyeds.
**/
)
{
gBS->CloseProtocol (
);
);
}
/**
Connect to the other endpoint of the TCP socket.
@param[in, out] Tcp4Io The Tcp4Io wrapping the TCP socket.
@param[in] Timeout The time to wait for connection done.
@retval EFI_SUCCESS Connect to the other endpoint of the TCP socket successfully.
@retval EFI_TIMEOUT Failed to connect to the other endpoint of the TCP socket in the specified time period.
@retval Others Other errors as indicated.
**/
)
{
return Status;
}
}
if (!Tcp4Io->IsConnDone) {
} else {
}
return Status;
}
/**
Reset the socket.
@param[in, out] Tcp4Io The Tcp4Io wrapping the TCP socket.
**/
)
{
return ;
}
while (!Tcp4Io->IsCloseDone) {
}
}
/**
Transmit the Packet to the other endpoint of the socket.
@param[in] Tcp4Io The Tcp4Io wrapping the TCP socket.
@param[in] Packet The packet to transmit.
@retval EFI_SUCCESS The packet is trasmitted.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
@retval Others Other errors as indicated.
**/
)
{
TxData = AllocatePool (sizeof (EFI_TCP4_TRANSMIT_DATA) + (Packet->BlockOpNum - 1) * sizeof (EFI_TCP4_FRAGMENT_DATA));
return EFI_OUT_OF_RESOURCES;
}
//
// Build the fragment table.
//
//
// Trasnmit the packet.
//
goto ON_EXIT;
}
}
return Status;
}
/**
Receive data from the socket.
@param[in] Tcp4Io The Tcp4Io which wraps the socket to be destroyed.
@param[in] Packet The buffer to hold the data copy from the soket rx buffer.
@param[in] AsyncMode Is this receive asyncronous or not.
@param[in] Timeout The time to wait for receiving the amount of data the Packet
can hold.
@retval EFI_SUCCESS The required amount of data is received from the socket.
@retval EFI_OUT_OF_RESOURCES Failed to allocate momery.
@retval EFI_TIMEOUT Failed to receive the required amount of data in the
specified time period.
@retval Others Other errors as indicated.
**/
)
{
return EFI_OUT_OF_RESOURCES;
}
//
// Build the fragment table.
//
CurrentFragment = 0;
while (CurrentFragment < FragmentCount) {
goto ON_EXIT;
}
//
// Poll until some data is received or something error happens.
//
}
//
// Timeout occurs, cancel the receive request.
//
goto ON_EXIT;
} else {
}
goto ON_EXIT;
}
} else {
}
}
return Status;
}