• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eclipse-bluechi / bluechi / 15045181532

15 May 2025 12:39PM UTC coverage: 37.505% (-44.9%) from 82.405%
15045181532

Pull #1072

github

web-flow
Merge 1d8b9dfa8 into 04834083b
Pull Request #1072: Prevent tmt from pruning coverage files

1888 of 5034 relevant lines covered (37.5%)

23.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/controller/node.h
1
/*
2
 * Copyright Contributors to the Eclipse BlueChi project
3
 *
4
 * SPDX-License-Identifier: LGPL-2.1-or-later
5
 */
6
#pragma once
7

8
#include <hashmap.h>
9

10
#include "libbluechi/common/common.h"
11

12
#include "types.h"
13

14
typedef int (*agent_request_response_t)(AgentRequest *req, sd_bus_message *m, sd_bus_error *ret_error);
15

16
struct AgentRequest {
17
        int ref_count;
18
        Node *node;
19

20
        sd_bus_slot *slot;
21

22
        sd_bus_message *message;
23

24
        void *userdata;
25
        free_func_t free_userdata;
26
        agent_request_response_t cb;
27

28
        bool is_cancelled;
29

30
        LIST_FIELDS(AgentRequest, outstanding_requests);
31
};
32

33
AgentRequest *agent_request_ref(AgentRequest *req);
34
void agent_request_unref(AgentRequest *req);
35
int agent_request_start(AgentRequest *req);
36
int agent_request_cancel(AgentRequest *r);
37

38
struct Node {
39
        int ref_count;
40

41
        Controller *controller; /* weak ref */
42

43
        /* public bus api */
44
        sd_bus_slot *export_slot;
45

46
        /* internal bus api */
47
        sd_bus *agent_bus;
48
        sd_bus_slot *internal_controller_slot;
49
        sd_bus_slot *disconnect_slot;
50
        sd_bus_slot *metrics_matching_slot;
51

52
        LIST_FIELDS(Node, nodes);
53

54
        char *name; /* NULL for not yet registered nodes */
55
        char *required_selinux_context;
56
        char *object_path;
57
        char *peer_ip;
58
        char *peer_selinux_context;
59

60
        LIST_HEAD(AgentRequest, outstanding_requests);
61
        LIST_HEAD(ProxyMonitor, proxy_monitors);
62
        LIST_HEAD(ProxyDependency, proxy_dependencies);
63

64
        struct hashmap *unit_subscriptions;
65
        uint64_t last_seen;
66
        uint64_t last_seen_monotonic;
67

68
        bool is_shutdown;
69
};
70

71
Node *node_new(Controller *controller, const char *name);
72
Node *node_ref(Node *node);
73
void node_unref(Node *node);
74
void node_shutdown(Node *node);
75
void node_disconnect(Node *node);
76

77
const char *node_get_status(Node *node);
78

79
bool node_export(Node *node);
80
bool node_has_agent(Node *node);
81
bool node_is_online(Node *node);
82
bool node_set_agent_bus(Node *node, sd_bus *bus);
83
void node_unset_agent_bus(Node *node);
84
bool node_set_required_selinux_context(Node *node, const char *selinux_context);
85

86
AgentRequest *node_request_list_units(
87
                Node *node, agent_request_response_t cb, void *userdata, free_func_t free_userdata);
88
AgentRequest *node_request_list_unit_files(
89
                Node *node, agent_request_response_t cb, void *userdata, free_func_t free_userdata);
90

91
void node_subscribe(Node *node, Subscription *sub);
92
void node_unsubscribe(Node *node, Subscription *sub);
93

94
int node_add_proxy_dependency(Node *node, const char *unit_name);
95
int node_remove_proxy_dependency(Node *node, const char *unit_name);
96

97
int node_create_request(
98
                AgentRequest **ret,
99
                Node *node,
100
                const char *method,
101
                agent_request_response_t cb,
102
                void *userdata,
103
                free_func_t free_userdata);
104

105
void node_remove_proxy_monitor(Node *node, ProxyMonitor *proxy_monitor);
106

107
int node_method_get_unit_uint64_property_sync(Node *node, char *unit, char *property, uint64_t *value);
108
void node_enable_metrics(Node *node);
109
void node_disable_metrics(Node *node);
110

111
DEFINE_CLEANUP_FUNC(Node, node_unref)
4✔
112
#define _cleanup_node_ _cleanup_(node_unrefp)
113
DEFINE_CLEANUP_FUNC(AgentRequest, agent_request_unref)
×
114
#define _cleanup_agent_request_ _cleanup_(agent_request_unrefp)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc