delete KCONN(configuration);
}
-static int getNames(const char *name, KdbusConnectionInfo &info,
+/*
+ * This function prepares contents of info.names() for initialization of MatchItems.
+ * First, it tries to get names from kdbus connection.
+ * If it fails, names are added from the 'name' parameter, which is treaten
+ * as a string containing names separated by single space.
+ */
+static int prepareNames(const char *name, KdbusConnectionInfo &info,
KdbusConnection::conn_info_type info_type) {
if (name && *name) {
int r = info.get(name, info_type);
int r;
/* check can send */
/* if broadcasting, then pass - null destination */
- r = getNames(destination, destinationInfo, KdbusConnection::POLICY_CONN_INFO_ALL);
+ r = prepareNames(destination, destinationInfo, KdbusConnection::POLICY_CONN_INFO_ALL);
if (r < 0)
return r;
KdbusConnectionInfo senderInfo(kconn->conn);
/* check can recv */
/* get sender information from kdbus */
- r = getNames(sender, senderInfo, KdbusConnection::POLICY_CONN_INFO_NAME);
+ r = prepareNames(sender, senderInfo, KdbusConnection::POLICY_CONN_INFO_NAME);
if (r < 0)
return r;
auto kconn = KCONN(configuration);
KdbusConnectionInfo info(kconn->conn);
int r;
- r = getNames(destination, info, KdbusConnection::POLICY_CONN_INFO_NAME);
+ r = prepareNames(destination, info, KdbusConnection::POLICY_CONN_INFO_NAME);
if (r < 0)
return r;