2 ctdb_tunnel protocol code
4 Copyright (C) Amitay Isaacs 2017
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include "system/network.h"
27 #include "lib/util/debug.h"
29 #include "common/logging.h"
30 #include "common/reqid.h"
31 #include "common/srvid.h"
33 #include "ctdb_private.h"
35 int32_t ctdb_control_tunnel_register(struct ctdb_context
*ctdb
,
36 uint32_t client_id
, uint64_t tunnel_id
)
38 struct ctdb_client
*client
;
41 client
= reqid_find(ctdb
->idr
, client_id
, struct ctdb_client
);
43 DEBUG(DEBUG_ERR
, ("Bad client_id in ctdb_tunnel_register\n"));
47 ret
= srvid_exists(ctdb
->tunnels
, tunnel_id
, NULL
);
50 ("Tunnel id 0x%"PRIx64
" already registered\n",
55 ret
= srvid_register(ctdb
->tunnels
, client
, tunnel_id
,
56 daemon_tunnel_handler
, client
);
59 ("Failed to register tunnel id 0x%"PRIx64
"\n",
64 DEBUG(DEBUG_INFO
, ("Registered tunnel for id 0x%"PRIx64
"\n",
69 int32_t ctdb_control_tunnel_deregister(struct ctdb_context
*ctdb
,
70 uint32_t client_id
, uint64_t tunnel_id
)
72 struct ctdb_client
*client
;
75 client
= reqid_find(ctdb
->idr
, client_id
, struct ctdb_client
);
77 DEBUG(DEBUG_ERR
, ("Bad client_id in ctdb_tunnel_deregister\n"));
81 ret
= srvid_deregister(ctdb
->tunnels
, tunnel_id
, client
);
84 ("Failed to deregister tunnel id 0x%"PRIx64
"\n",