VirtualBox

Changeset 49349 in vbox for trunk/include/VBox/HostServices


Ignore:
Timestamp:
Oct 31, 2013 4:40:46 PM (11 years ago)
Author:
vboxsync
Message:

Guest Control:

  • Implemented IGuestSession::DirectoryRemove, IGuestSession::DirectoryRemoveRecursive, IGuestSession::DirectoryRename + IGuestSession::FileRename.
  • Added appropriate commands to VBoxManage (basic support for now).
  • Implemented support for proper guest session process termination via SCM.
  • Implemented support for internal anonymous wait events which are not relying on the public API's VBoxEventType_T.
  • Various bugfixes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HostServices/GuestControlSvc.h

    r47817 r49349  
    121121
    122122/**
     123 * Guest directory removement flags.
     124 * Essentially using what IPRT's RTDIRRMREC_F_
     125 * defines have to offer.
     126 */
     127#define DIRREMOVE_FLAG_RECURSIVE            RT_BIT(0)
     128/** Delete the content of the directory and the directory itself. */
     129#define DIRREMOVE_FLAG_CONTENT_AND_DIR      RT_BIT(1)
     130/** Only delete the content of the directory, omit the directory it self. */
     131#define DIRREMOVE_FLAG_CONTENT_ONLY         RT_BIT(2)
     132/** Mask of valid flags. */
     133#define DIRREMOVE_FLAG_VALID_MASK           UINT32_C(0x00000003)
     134
     135/**
    123136 * Guest process creation flags.
    124137 * Note: Has to match Main's ProcessCreateFlag_* flags!
     
    140153#define OUTPUT_HANDLE_ID_STDOUT             1
    141154#define OUTPUT_HANDLE_ID_STDERR             2
     155
     156/**
     157 * Guest path rename flags.
     158 * Essentially using what IPRT's RTPATHRENAME_FLAGS_
     159 * defines have to offer.
     160 */
     161/** Do not replace anything. */
     162#define PATHRENAME_FLAG_NO_REPLACE          UINT32_C(0)
     163/** This will replace attempt any target which isn't a directory. */
     164#define PATHRENAME_FLAG_REPLACE             RT_BIT(0)
     165/** Don't allow symbolic links as part of the path. */
     166#define PATHRENAME_FLAG_NO_SYMLINKS         RT_BIT(1)
     167/** Mask of valid flags. */
     168#define PATHRENAME_FLAG_VALID_MASK          UINT32_C(0x00000002)
    142169
    143170/**
     
    203230                                : mParms(cParms), mpaParms(paParms) { }
    204231
     232    /** Number of HGCM parameters. */
    205233    uint32_t mParms;
     234    /** Actual HGCM parameters. */
    206235    PVBOXHGCMSVCPARM mpaParms;
    207236
     
    284313     * Gets the current file position of an opened guest file.
    285314     */
    286     HOST_FILE_TELL = 271
     315    HOST_FILE_TELL = 271,
     316    /**
     317     * Removes a directory on the guest.
     318     */
     319    HOST_DIR_REMOVE = 320,
     320    /**
     321     * Renames a path on the guest.
     322     */
     323    HOST_PATH_RENAME = 330
    287324};
    288325
     
    290327 * The service functions which are called by guest. The numbers may not change,
    291328 * so we hardcode them.
    292  *
    293  * Note: Callbacks start at 100. See CALLBACKTYPE enum.
    294329 */
    295330enum eGuestFn
     
    328363    GUEST_MSG_SKIP = 10,
    329364    /**
     365     * General reply to a host message. Only contains basic data
     366     * along with a simple payload.
     367     */
     368    GUEST_MSG_REPLY = 11,
     369    /**
     370     * General message for updating a pending progress for
     371     * a long task.
     372     */
     373    GUEST_MSG_PROGRESS_UPDATE = 12,
     374    /**
    330375     * Guest reports back a guest session status.
    331376     */
    332377    GUEST_SESSION_NOTIFY = 20,
     378    /**
     379     * Guest wants to close a specific guest session.
     380     */
     381    GUEST_SESSION_CLOSE = 21,
    333382    /**
    334383     * Guests sends output from an executed process.
     
    350399     */
    351400    GUEST_EXEC_IO_NOTIFY = 210,
     401    /**
     402     * Guest notifies the host about some directory event.
     403     */
     404    GUEST_DIR_NOTIFY = 230,
    352405    /**
    353406     * Guest notifies the host about some file event.
     
    382435
    383436/**
     437 * Guest directory notification types.
     438 * @sa HGCMMsgDirNotify.
     439 */
     440enum GUEST_DIR_NOTIFYTYPE
     441{
     442    GUEST_DIR_NOTIFYTYPE_UNKNOWN = 0,
     443    /** Something went wrong (see rc). */
     444    GUEST_DIR_NOTIFYTYPE_ERROR = 1,
     445    /** Guest directory opened. */
     446    GUEST_DIR_NOTIFYTYPE_OPEN = 10,
     447    /** Guest directory closed. */
     448    GUEST_DIR_NOTIFYTYPE_CLOSE = 20,
     449    /** Information about an open guest directory. */
     450    GUEST_DIR_NOTIFYTYPE_INFO = 40,
     451    /** Guest directory created. */
     452    GUEST_DIR_NOTIFYTYPE_CREATE = 70,
     453    /** Guest directory deleted. */
     454    GUEST_DIR_NOTIFYTYPE_REMOVE = 80
     455};
     456
     457/**
    384458 * Guest file notification types.
    385459 * @sa HGCMMsgFileNotify.
     
    421495{
    422496    VBoxGuestHGCMCallInfo hdr;
    423 
    424497    /**
    425498     * The returned command the host wants to
     
    429502    /** Number of parameters the message needs. */
    430503    HGCMFunctionParameter num_parms; /* OUT uint32_t */
    431 
    432504} HGCMMsgCmdWaitFor;
    433505
     
    441513{
    442514    VBoxGuestHGCMCallInfo hdr;
    443 
    444515    /** Value to filter for after filter mask
    445516     *  was applied. */
     
    451522    /** Filter flags; currently unused. */
    452523    HGCMFunctionParameter flags;         /* IN uint32_t */
    453 
    454524} HGCMMsgCmdFilterSet;
    455525
     
    461531{
    462532    VBoxGuestHGCMCallInfo hdr;
    463 
    464533    /** Unset flags; currently unused. */
    465534    HGCMFunctionParameter flags;    /* IN uint32_t */
     
    474543{
    475544    VBoxGuestHGCMCallInfo hdr;
    476 
    477545    /** Skip flags; currently unused. */
    478546    HGCMFunctionParameter flags;    /* IN uint32_t */
     
    487555    VBoxGuestHGCMCallInfo hdr;
    488556} HGCMMsgCancelPendingWaits;
     557
     558typedef struct HGCMMsgCmdReply
     559{
     560    VBoxGuestHGCMCallInfo hdr;
     561    /** Context ID. */
     562    HGCMFunctionParameter context;
     563    /** Message type. */
     564    HGCMFunctionParameter type;
     565    /** IPRT result of overall operation. */
     566    HGCMFunctionParameter rc;
     567    /** Optional payload to this reply. */
     568    HGCMFunctionParameter payload;
     569} HGCMMsgCmdReply;
    489570
    490571/**
     
    534615    HGCMFunctionParameter result;
    535616} HGCMMsgSessionNotify;
     617
     618typedef struct HGCMMsgPathRename
     619{
     620    VBoxGuestHGCMCallInfo hdr;
     621    /** UInt32: Context ID. */
     622    HGCMFunctionParameter context;
     623    /** Source to rename. */
     624    HGCMFunctionParameter source;
     625    /** Destination to rename source to. */
     626    HGCMFunctionParameter dest;
     627    /** UInt32: Rename flags. */
     628    HGCMFunctionParameter flags;
     629} HGCMMsgPathRename;
    536630
    537631/**
     
    575669        struct
    576670        {
    577             /** Timeout (in msec) which either specifies the
     671            /** Timeout (in ms) which either specifies the
    578672             *  overall lifetime of the process or how long it
    579673             *  can take to bring the process up and running -
     
    588682        } v2;
    589683    } u;
    590 
    591684} HGCMMsgProcExec;
    592685
     
    607700    /** Actual size of data (in bytes). */
    608701    HGCMFunctionParameter size;
    609 
    610702} HGCMMsgProcInput;
    611703
     
    627719    /** Data buffer. */
    628720    HGCMFunctionParameter data;
    629 
    630721} HGCMMsgProcOutput;
    631722
     
    646737    /** Optional data buffer (not used atm). */
    647738    HGCMFunctionParameter data;
    648 
    649739} HGCMMsgProcStatus;
    650740
     
    665755    /** Data written. */
    666756    HGCMFunctionParameter written;
    667 
    668757} HGCMMsgProcStatusInput;
    669758
     
    682771    /** The process ID (PID). */
    683772    HGCMFunctionParameter pid;
    684 
    685773} HGCMMsgProcTerminate;
    686774
     
    699787    /** Timeout (in ms). */
    700788    HGCMFunctionParameter timeout;
    701 
    702789} HGCMMsgProcWaitFor;
     790
     791typedef struct HGCMMsgDirRemove
     792{
     793    VBoxGuestHGCMCallInfo hdr;
     794    /** UInt32: Context ID. */
     795    HGCMFunctionParameter context;
     796    /** Directory to remove. */
     797    HGCMFunctionParameter path;
     798    /** UInt32: Removement flags. */
     799    HGCMFunctionParameter flags;
     800} HGCMMsgDirRemove;
    703801
    704802/**
     
    722820    /** UInt64: Initial offset. */
    723821    HGCMFunctionParameter offset;
    724 
    725822} HGCMMsgFileOpen;
    726823
     
    735832    /** File handle to close. */
    736833    HGCMFunctionParameter handle;
    737 
    738834} HGCMMsgFileClose;
    739835
     
    750846    /** Size (in bytes) to read. */
    751847    HGCMFunctionParameter size;
    752 
    753848} HGCMMsgFileRead;
    754849
     
    767862    /** Actual size of data (in bytes). */
    768863    HGCMFunctionParameter size;
    769 
    770864} HGCMMsgFileReadAt;
    771865
     
    784878    /** Data buffer to write to the file. */
    785879    HGCMFunctionParameter data;
    786 
    787880} HGCMMsgFileWrite;
    788881
     
    803896    /** Data buffer to write to the file. */
    804897    HGCMFunctionParameter data;
    805 
    806898} HGCMMsgFileWriteAt;
    807899
     
    820912    /** The seeking offset. */
    821913    HGCMFunctionParameter offset;
    822 
    823914} HGCMMsgFileSeek;
    824915
     
    833924    /** File handle to get the current position for. */
    834925    HGCMFunctionParameter handle;
    835 
    836926} HGCMMsgFileTell;
    837927
     
    877967        } tell;
    878968    } u;
    879 
    880969} HGCMReplyFileNotify;
     970
     971typedef struct HGCMReplyDirNotify
     972{
     973    VBoxGuestHGCMCallInfo hdr;
     974    /** Context ID. */
     975    HGCMFunctionParameter context;
     976    /** Notification type. */
     977    HGCMFunctionParameter type;
     978    /** IPRT result of overall operation. */
     979    HGCMFunctionParameter rc;
     980    union
     981    {
     982        struct
     983        {
     984            /** Directory information. */
     985            HGCMFunctionParameter objInfo;
     986        } info;
     987        struct
     988        {
     989            /** Guest directory handle. */
     990            HGCMFunctionParameter handle;
     991        } open;
     992        struct
     993        {
     994            /** Current read directory entry. */
     995            HGCMFunctionParameter entry;
     996            /** Extended entry object information. Optional. */
     997            HGCMFunctionParameter objInfo;
     998        } read;
     999    } u;
     1000} HGCMReplyDirNotify;
    8811001
    8821002#pragma pack ()
     
    9081028    CALLBACKDATA_HEADER hdr;
    9091029} CALLBACKDATA_CLIENT_DISCONNECTED, *PCALLBACKDATA_CLIENT_DISCONNECTED;
     1030
     1031typedef struct CALLBACKDATA_MSG_REPLY
     1032{
     1033    /** Callback data header. */
     1034    CALLBACKDATA_HEADER hdr;
     1035    /** Notification type. */
     1036    uint32_t uType;
     1037    /** Notification result. Note: int vs. uint32! */
     1038    uint32_t rc;
     1039    /** Pointer to optional payload. */
     1040    void *pvPayload;
     1041    /** Payload size (in bytes). */
     1042    uint32_t cbPayload;
     1043} CALLBACKDATA_MSG_REPLY, *PCALLBACKDATA_MSG_REPLY;
    9101044
    9111045typedef struct CALLBACKDATA_SESSION_NOTIFY
     
    9661100
    9671101/**
    968  * General guest file notification callback.
    969  */
    970 typedef struct CALLBACKDATA_FILE_NOTIFY
     1102 * General guest directory notification callback.
     1103 */
     1104typedef struct CALLBACKDATA_DIR_NOTIFY
    9711105{
    9721106    /** Callback data header. */
     
    9801114        struct
    9811115        {
     1116            /** Size (in bytes) of directory information. */
     1117            uint32_t cbObjInfo;
     1118            /** Pointer to directory information. */
     1119            void *pvObjInfo;
     1120        } info;
     1121        struct
     1122        {
     1123            /** Guest directory handle. */
     1124            uint32_t uHandle;
     1125        } open;
     1126        /** Note: Close does not have any additional data (yet). */
     1127        struct
     1128        {
     1129            /** Size (in bytes) of directory entry information. */
     1130            uint32_t cbEntry;
     1131            /** Pointer to directory entry information. */
     1132            void *pvEntry;
     1133            /** Size (in bytes) of directory entry object information. */
     1134            uint32_t cbObjInfo;
     1135            /** Pointer to directory entry object information. */
     1136            void *pvObjInfo;
     1137        } read;
     1138    } u;
     1139} CALLBACKDATA_DIR_NOTIFY, *PCALLBACKDATA_DIR_NOTIFY;
     1140
     1141/**
     1142 * General guest file notification callback.
     1143 */
     1144typedef struct CALLBACKDATA_FILE_NOTIFY
     1145{
     1146    /** Callback data header. */
     1147    CALLBACKDATA_HEADER hdr;
     1148    /** Notification type. */
     1149    uint32_t uType;
     1150    /** IPRT result of overall operation. */
     1151    uint32_t rc;
     1152    union
     1153    {
     1154        struct
     1155        {
    9821156            /** Guest file handle. */
    9831157            uint32_t uHandle;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette