varlink: add introspection data for the org.varlink.service and io.systemd interfaces
The official org.varlink.service interface definition, as per: https://varlink.org/Service And the io.systemd service where we carry some super generic errors our Varlink implementation generates.
This commit is contained in:
@@ -167,6 +167,8 @@ shared_sources = files(
|
||||
'userdb.c',
|
||||
'varlink.c',
|
||||
'varlink-idl.c',
|
||||
'varlink-io.systemd.c',
|
||||
'varlink-org.varlink.service.c',
|
||||
'verb-log-control.c',
|
||||
'verbs.c',
|
||||
'vlan-util.c',
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "varlink-io.systemd.h"
|
||||
|
||||
/* These are local errors that never cross the wire, and are our own invention */
|
||||
static VARLINK_DEFINE_ERROR(Disconnected);
|
||||
static VARLINK_DEFINE_ERROR(TimedOut);
|
||||
static VARLINK_DEFINE_ERROR(Protocol);
|
||||
|
||||
/* This one we invented, and use for generically propagating system errors (errno) to clients */
|
||||
static VARLINK_DEFINE_ERROR(
|
||||
System,
|
||||
VARLINK_DEFINE_FIELD(errno, VARLINK_INT, 0));
|
||||
|
||||
VARLINK_DEFINE_INTERFACE(
|
||||
io_systemd,
|
||||
"io.systemd",
|
||||
&vl_error_Disconnected,
|
||||
&vl_error_TimedOut,
|
||||
&vl_error_Protocol,
|
||||
&vl_error_System);
|
||||
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include "varlink-idl.h"
|
||||
|
||||
extern const VarlinkInterface vl_interface_io_systemd;
|
||||
@@ -0,0 +1,45 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "varlink-org.varlink.service.h"
|
||||
|
||||
static VARLINK_DEFINE_METHOD(
|
||||
GetInfo,
|
||||
VARLINK_DEFINE_OUTPUT(vendor, VARLINK_STRING, 0),
|
||||
VARLINK_DEFINE_OUTPUT(product, VARLINK_STRING, 0),
|
||||
VARLINK_DEFINE_OUTPUT(version, VARLINK_STRING, 0),
|
||||
VARLINK_DEFINE_OUTPUT(url, VARLINK_STRING, 0),
|
||||
VARLINK_DEFINE_OUTPUT(interfaces, VARLINK_STRING, VARLINK_ARRAY));
|
||||
|
||||
static VARLINK_DEFINE_METHOD(
|
||||
GetInterfaceDescription,
|
||||
VARLINK_DEFINE_OUTPUT(interface, VARLINK_STRING, 0));
|
||||
|
||||
static VARLINK_DEFINE_ERROR(
|
||||
InterfaceNotFound,
|
||||
VARLINK_DEFINE_FIELD(interface, VARLINK_STRING, 0));
|
||||
|
||||
static VARLINK_DEFINE_ERROR(
|
||||
MethodNotFound,
|
||||
VARLINK_DEFINE_FIELD(method, VARLINK_STRING, 0));
|
||||
|
||||
static VARLINK_DEFINE_ERROR(
|
||||
MethodNotImplemented,
|
||||
VARLINK_DEFINE_FIELD(method, VARLINK_STRING, 0));
|
||||
|
||||
static VARLINK_DEFINE_ERROR(
|
||||
InvalidParameter,
|
||||
VARLINK_DEFINE_FIELD(parameter, VARLINK_STRING, 0));
|
||||
|
||||
static VARLINK_DEFINE_ERROR(PermissionDenied);
|
||||
|
||||
/* As per https://varlink.org/Service */
|
||||
VARLINK_DEFINE_INTERFACE(
|
||||
org_varlink_service,
|
||||
"org.varlink.service",
|
||||
&vl_method_GetInfo,
|
||||
&vl_method_GetInterfaceDescription,
|
||||
&vl_error_InterfaceNotFound,
|
||||
&vl_error_MethodNotFound,
|
||||
&vl_error_MethodNotImplemented,
|
||||
&vl_error_InvalidParameter,
|
||||
&vl_error_PermissionDenied);
|
||||
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include "varlink-idl.h"
|
||||
|
||||
extern const VarlinkInterface vl_interface_org_varlink_service;
|
||||
@@ -187,6 +187,8 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(VarlinkServer *, varlink_server_unref);
|
||||
#define VARLINK_ERROR_DISCONNECTED "io.systemd.Disconnected"
|
||||
#define VARLINK_ERROR_TIMEOUT "io.systemd.TimedOut"
|
||||
#define VARLINK_ERROR_PROTOCOL "io.systemd.Protocol"
|
||||
|
||||
/* This one we invented, and use for generically propagating system errors (errno) to clients */
|
||||
#define VARLINK_ERROR_SYSTEM "io.systemd.System"
|
||||
|
||||
/* These are errors defined in the Varlink spec */
|
||||
|
||||
Reference in New Issue
Block a user