void *clientData);
static Bool HgfsServerSessionConnect(void *transportData,
HgfsServerChannelCallbacks *channelCbTable,
- uint32 channelCapabililies,
+ HgfsServerChannelData *channelCapabililies,
void **clientData);
static void HgfsServerSessionDisconnect(void *clientData);
static void HgfsServerSessionClose(void *clientData);
static void HgfsServerTransportRemoveSessionFromList(HgfsTransportSessionInfo *transportSession,
HgfsSessionInfo *sessionInfo);
-/*
- * Limit payload to 16M + header.
- * This limit ensures that list of shared pages fits into VMCI datagram.
- * Client may impose a lower limit in create session request.
- */
-#define MAX_SERVER_PACKET_SIZE_V4 (0x1000000 + sizeof(HgfsHeader))
-
/* Local functions. */
static void HgfsInvalidateSessionObjects(DblLnkLst_Links *shares,
HgfsSessionInfo *session);
static Bool
HgfsServerSessionConnect(void *transportData, // IN: transport session context
HgfsServerChannelCallbacks *channelCbTable, // IN: Channel callbacks
- uint32 channelCapabilities, // IN: channel capabilities
+ HgfsServerChannelData *channelCapabilities, // IN: channel capabilities
void **transportSessionData) // OUT: server session context
{
HgfsTransportSessionInfo *transportSession;
transportSession = Util_SafeCalloc(1, sizeof *transportSession);
transportSession->transportData = transportData;
transportSession->channelCbTable = channelCbTable;
- transportSession->maxPacketSize = MAX_SERVER_PACKET_SIZE_V4;
transportSession->type = HGFS_SESSION_TYPE_REGULAR;
transportSession->state = HGFS_SESSION_STATE_OPEN;
- transportSession->channelCapabilities = channelCapabilities;
+ transportSession->channelCapabilities = *channelCapabilities;
transportSession->numSessions = 0;
transportSession->sessionArrayLock =
Bool
HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession, // IN:
- uint32 channelCapabilities, // IN:
HgfsSessionInfo **sessionData) // OUT:
{
int i;
session->sessionId = HgfsGenerateSessionId();
session->state = HGFS_SESSION_STATE_OPEN;
DblLnkLst_Init(&session->links);
- session->maxPacketSize = MAX_SERVER_PACKET_SIZE_V4;
+ session->maxPacketSize = transportSession->channelCapabilities.maxPacketSize;
session->activeNotification = FALSE;
session->isInactive = TRUE;
session->transportSession = transportSession;
HgfsServerGetDefaultCapabilities(session->hgfsSessionCapabilities,
&session->numberOfCapabilities);
- if (channelCapabilities & HGFS_CHANNEL_SHARED_MEM) {
+ if (transportSession->channelCapabilities.flags & HGFS_CHANNEL_SHARED_MEM) {
HgfsServerSetSessionCapability(HGFS_OP_READ_FAST_V4,
HGFS_REQUEST_SUPPORTED, session);
HgfsServerSetSessionCapability(HGFS_OP_WRITE_FAST_V4,
LOG(4, ("%s: create session\n", __FUNCTION__));
if (!HgfsServerAllocateSession(input->transportSession,
- input->transportSession->channelCapabilities,
&session)) {
status = HGFS_ERROR_NOT_ENOUGH_MEMORY;
goto abort;
#include "hgfsUtil.h" // for HgfsInternalStatus
#include "vm_atomic.h"
#include "userlock.h"
+#include "hgfsServer.h" // for the server public types
#define HGFS_DEBUG_ASYNC (0)
Atomic_uint32 refCount; /* Reference count for session. */
- uint32 channelCapabilities;
+ HgfsServerChannelData channelCapabilities;
} HgfsTransportSessionInfo;
typedef struct HgfsSessionInfo {
/* Allocate/Add sessions helper functions. */
Bool HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession,
- uint32 channelCapabilities,
HgfsSessionInfo **sessionData);
void HgfsServerSessionGet(HgfsSessionInfo *session);
#define HGFS_SEND_NO_COMPLETE (1 << 1)
// Channel capability flags
+typedef uint32 HgfsChannelFlags;
#define HGFS_CHANNEL_SHARED_MEM (1 << 0)
#define HGFS_CHANNEL_ASYNC (1 << 1)
+typedef struct HgfsServerChannelData {
+ HgfsChannelFlags flags;
+ uint32 maxPacketSize;
+}HgfsServerChannelData;
+
typedef Bool
HgfsSessionSendFunc(void *opaqueSession, // IN
char *buffer, // IN
}HgfsServerChannelCallbacks;
typedef struct HgfsServerSessionCallbacks {
- Bool (*connect)(void *, HgfsServerChannelCallbacks *, uint32 ,void **);
+ Bool (*connect)(void *, HgfsServerChannelCallbacks *, HgfsServerChannelData *,void **);
void (*disconnect)(void *);
void (*close)(void *);
void (*receive)(HgfsPacket *packet, void *);