Top | ![]() |
![]() |
![]() |
![]() |
UMockdevIoctlData * | arg | Read |
gboolean | connected | Read |
char * | devnode | Read |
gulong | request | Read |
void | client-connected | Run Last |
void | client-vanished | Run Last |
gboolean | handle-ioctl | Run Last |
gboolean | handle-read | Run Last |
gboolean | handle-write | Run Last |
gboolean | handle-ioctl | Run Last |
gboolean | handle-read | Run Last |
gboolean | handle-write | Run Last |
struct | UMockdevIoctlBase |
struct | UMockdevIoctlBaseClass |
struct | UMockdevIoctlData |
struct | UMockdevIoctlClient |
These classes permit emulation of ioctl and read/write calls including
fully customizing the behaviour by creating an UMockdevIoctlBase instance or
subclass instance and attaching it using umockdev_testbed_attach_ioctl()
.
struct UMockdevIoctlBase;
The UMockdevIoctlBase class is a base class to emulate and record ioctl operations of a client. It can be attached to an emulated device in the testbed and will then be used.
Since: 0.16
struct UMockdevIoctlBaseClass { GObjectClass parent_class; gboolean (*handle_ioctl) (UMockdevIoctlBase* self, UMockdevIoctlClient* client); gboolean (*handle_read) (UMockdevIoctlBase* self, UMockdevIoctlClient* client); gboolean (*handle_write) (UMockdevIoctlBase* self, UMockdevIoctlClient* client); void (*client_connected) (UMockdevIoctlBase* self, UMockdevIoctlClient* client); void (*client_vanished) (UMockdevIoctlBase* self, UMockdevIoctlClient* client); };
The base class for an device ioctl and read/write handling. You can either override the corresponding vfuncs or connect to the signals to customize the emulation.
Since: 0.16
struct UMockdevIoctlData;
The UMockdevIoctlData struct is a container designed to read and write memory from the client process.
After memory has been resolved, the corresponding pointer will point to
local memory that can be used normally. The memory will automatically be
synced back by umockdev_ioctl_client_complete()
.
Since: 0.16
struct UMockdevIoctlClient;
The UMockdevIoctlClient struct represents an opened client side FD in order to emulate ioctl calls on this device.
Since: 0.16
“arg”
property“arg” UMockdevIoctlData *
The ioctl argument, for read/write the passed buffer.
Owner: UMockdevIoctlClient
Flags: Read
“connected”
property “connected” gboolean
Whether the client is still connected.
Owner: UMockdevIoctlClient
Flags: Read
Default value: FALSE
“devnode”
property “devnode” char *
The device node the client opened.
Owner: UMockdevIoctlClient
Flags: Read
Default value: NULL
“client-connected”
signalvoid user_function (UMockdevIoctlBase *umockdevioctlbase, UMockdevIoctlClient *arg1, gpointer user_data)
Flags: Run Last
“client-vanished”
signalvoid user_function (UMockdevIoctlBase *umockdevioctlbase, UMockdevIoctlClient *arg1, gpointer user_data)
Flags: Run Last
“handle-ioctl”
signalgboolean user_function (UMockdevIoctlBase *handler, UMockdevIoctlClient *client, gpointer user_data)
Called when an ioctl is requested by the client.
Access the “arg” property of client
to retrieve the
argument of the ioctl. This is a pointer sized buffer initially with the
original argument passed to the ioctl. If this is pointing to a struct, use
umockdev_ioctl_data_resolve()
to retrieve the underlying memory and update
the pointer. Resolve any further pointers in the structure in the same way.
After resolving the memory, you can access it as if it was local. The memory will be synced back to the client automatically if it has been modified locally.
Once processing is done, use umockdev_ioctl_client_complete()
to let the
client continue with the result of the emulation. You can also use
umockdev_ioctl_client_abort()
to kill the client. Note that this handling
does not need to be immediate. It is valid to immediately return TRUE from
this function and call umockdev_ioctl_client_complete()
at a later point.
Note that this function will be called from a worker thread with a private GMainContext for the UMockdevTestbed. Do not block this context for longer periods. The complete handler may be called from a different thread.
Flags: Run Last
Since: 0.16
“handle-read”
signalgboolean user_function (UMockdevIoctlBase *handler, UMockdevIoctlClient *client, gpointer user_data)
Called when a read is requested by the client.
The result buffer is represented by “arg” of client
.
Retrieve its length to find out the requested read length. The content of
the buffer has already been retrieved, and you can freely use and update it.
See “handle-ioctl” for some more information.
Flags: Run Last
Since: 0.16
“handle-write”
signalgboolean user_function (UMockdevIoctlBase *handler, UMockdevIoctlClient *client, gpointer user_data)
Called when a write is requested by the client.
The written buffer is represented by “arg” of client
.
Retrieve its length to find out the requested write length. The content of
the buffer has already been retrieved, and you can freely use it.
See “handle-ioctl” for some more information.
Flags: Run Last
Since: 0.16
“handle-ioctl”
signalgboolean user_function (UMockdevIoctlClient *client, gpointer user_data)
Called when an ioctl is requested by the client.
This is the per-client signal. See “handle-ioctl” on UMockdevIoctlBase.
Flags: Run Last
Since: 0.16
“handle-read”
signalgboolean user_function (UMockdevIoctlClient *client, gpointer user_data)
Called when a read is requested by the client.
This is the per-client signal. See “handle-read” on UMockdevIoctlBase.
Flags: Run Last
Since: 0.16
“handle-write”
signalgboolean user_function (UMockdevIoctlClient *client, gpointer user_data)
Called when a write is requested by the client.
This is the per-client signal. See “handle-write” on UMockdevIoctlBase.
Flags: Run Last
Since: 0.16