257
257
VIX_COMMAND_CATEGORY_ALWAYS_ALLOWED),
258
258
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_OPEN_TEAM,
259
259
VIX_COMMAND_CATEGORY_PRIVILEGED),
260
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_FIND_HOST_DEVICES,
261
VIX_COMMAND_CATEGORY_PRIVILEGED),
260
VIX_DEFINE_UNUSED_COMMAND,
263
262
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_ANSWER_MESSAGE,
264
263
VIX_COMMAND_CATEGORY_PRIVILEGED),
422
421
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_LIST_FILESYSTEMS,
423
422
VIX_COMMAND_CATEGORY_ALWAYS_ALLOWED),
424
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_CHANGE_DISPLAY_TOPOLOGY,
425
VIX_COMMAND_CATEGORY_ALWAYS_ALLOWED),
427
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_SUSPEND_AND_RESUME,
428
VIX_COMMAND_CATEGORY_PRIVILEGED),
430
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_REMOVE_BULK_SNAPSHOT,
431
VIX_COMMAND_CATEGORY_PRIVILEGED),
1462
1470
return commandInfo;
1463
1471
} // VixGetCommandInfoForOpCode
1475
*-----------------------------------------------------------------------------
1477
* VixMsg_AllocGenericRequestMsg --
1479
* Allocate and initialize a generic request message.
1481
* Assumes the caller holds the lock to 'propertyList'.
1485
* Upon retrun, *request will contain either the message with the
1486
* headers properly initialized or NULL.
1491
*-----------------------------------------------------------------------------
1495
VixMsg_AllocGenericRequestMsg(int opCode, // IN
1496
uint64 cookie, // IN
1497
int credentialType, // IN
1498
const char *userNamePassword, // IN
1500
VixPropertyListImpl *propertyList, // IN
1501
VixCommandGenericRequest **request) // OUT
1504
VixCommandGenericRequest *requestLocal = NULL;
1505
size_t msgHeaderAndBodyLength;
1506
char *serializedBufferBody = NULL;
1507
size_t serializedBufferLength = 0;
1509
if (NULL == request) {
1517
if (NULL != propertyList) {
1518
err = VixPropertyList_Serialize(propertyList,
1520
&serializedBufferLength,
1521
&serializedBufferBody);
1522
if (VIX_OK != err) {
1527
msgHeaderAndBodyLength = sizeof(*requestLocal) + serializedBufferLength;
1528
requestLocal = (VixCommandGenericRequest *)
1529
VixMsg_AllocRequestMsg(msgHeaderAndBodyLength,
1534
if (NULL == requestLocal) {
1539
requestLocal->options = options;
1540
requestLocal->propertyListSize = serializedBufferLength;
1542
if (NULL != serializedBufferBody) {
1543
char *dst = (char *)request + sizeof(*request);
1544
memcpy(dst, serializedBufferBody, serializedBufferLength);
1547
*request = requestLocal;
1551
free(serializedBufferBody);
1554
} // VixMsg_AllocGenericRequestMsg
1558
*-----------------------------------------------------------------------------
1560
* VixMsg_ParseGenericRequestMsg --
1562
* Extract the options and property list from the request
1563
* message, while validating message.
1571
*-----------------------------------------------------------------------------
1575
VixMsg_ParseGenericRequestMsg(const VixCommandGenericRequest *request, // IN
1576
int *options, // OUT
1577
VixPropertyListImpl *propertyList) // OUT
1580
uint64 headerAndBodyLength;
1582
if ((NULL == request) || (NULL == options) || (NULL == propertyList)) {
1589
VixPropertyList_Initialize(propertyList);
1592
* In most cases we will have already called VixMsg_ValidateResponseMsg()
1593
* on this request before, but call it here so that this function will
1594
* always be sufficient to validate the request.
1596
err = VixMsg_ValidateRequestMsg(request,
1597
request->header.commonHeader.totalMessageLength);
1598
if (VIX_OK != err) {
1602
if (request->header.commonHeader.totalMessageLength < sizeof *request) {
1603
err = VIX_E_INVALID_MESSAGE_BODY;
1607
headerAndBodyLength = (uint64) request->header.commonHeader.headerLength
1608
+ request->header.commonHeader.bodyLength;
1610
if (headerAndBodyLength < ((uint64) sizeof *request
1611
+ request->propertyListSize)) {
1612
err = VIX_E_INVALID_MESSAGE_BODY;
1616
if (request->propertyListSize > 0) {
1617
const char *serializedBuffer = (const char *) request + sizeof(*request);
1619
err = VixPropertyList_Deserialize(propertyList,
1621
request->propertyListSize);
1622
if (VIX_OK != err) {
1627
*options = request->options;
1633
} // VixMsg_ParseGenericRequestMsg