PadicoTM

Documentation

« back to PM2 home.
PadicoControl.h
Go to the documentation of this file.
1/*
2 * Padico -- a High Performance Parallel and Distributed Computing Environment
3 * Copyright (c) 2002-2024 INRIA and the University of Rennes 1
4 * Alexandre DENIS <Alexandre.Denis@inria.fr>
5 * Christian PEREZ <Christian.Perez@inria.fr>
6 *
7 * The software has been registered at the Agency for the Protection of
8 * Programs (APP) under the number IDDN.FR.001.260013.000.S.P.2002.000.10000.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
29#ifndef PADICO_REMOTECONTROL_H
30#define PADICO_REMOTECONTROL_H
31
32#include <Padico/Puk.h>
33#include <Padico/PadicoTM.h>
34#include <Padico/Topology.h>
35
37#undef PADICO_LAST_MODULE_NAME
38#define PADICO_LAST_MODULE_NAME PadicoControl
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
52 /* *** Internal PadicoControl API */
53
55
58
61
64
65#define padico_control_msg_add_cmd(MSG, TEXT, ...) \
66 padico_string_catf(padico_control_msg_get_cmd(MSG), (TEXT), ##__VA_ARGS__ )
67
68
70 extern void padico_control_msg_add_part(padico_control_msg_t msg, const void*text, size_t len);
71
74
77
80
83
84 /* The home interface for PadicoControl */
85
90
92 void padico_control_deliver_message(puk_instance_t controler, padico_topo_node_t from, char*cmd, size_t size);
93
95
98
99#ifndef __cplusplus
100
102 static inline void padico_control_send_oneway(padico_topo_node_t node, const char*msg)
103 {
105 }
106
114
117 {
120 return req;
121 }
122
125 {
127 if(net == NULL)
128 net = padico_topo_network_getbyid("ControlNetwork");
129 return net;
130 }
131
132#endif /* __cplusplus */
133
134
135 /* *** NetAccess Control *********************************** */
136
214
215 /* shortcuts for the event channel */
216
217#ifndef __cplusplus
218
252
253
256 {
257 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
258 event->kind = PADICO_CONTROL_EVENT_NEW_NODE;
259 event->NODE.controler = controler;
260 event->NODE.node = node;
262 }
273 {
274 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
276 event->PLUG_CONTROLER.controler = controler;
277 event->PLUG_CONTROLER.server = server;
279 }
280
282 {
283 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
285 event->PLUG_CONNECTOR.connector = connector;
287 }
288
290 {
291 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
293 event->PLUG_SELECTOR.selector = selector;
295 }
297 {
298 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
300 event->UNPLUG_CONTROLER.controler = controler;
302 }
304 {
305 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
307 event->UNPLUG_CONNECTOR.connector = connector;
309 }
310
312 {
313 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
315 event->UNPLUG_SELECTOR.selector = selector;
317 }
318
321 {
322 if(node != NULL)
323 {
324 struct padico_control_event_s*event = padico_malloc(sizeof(struct padico_control_event_s));
326 event->NODE.controler = controler;
327 event->NODE.node = node;
329 }
330 }
331
332#endif /* __cplusplus */
333
334
335 /* ** PadicoControl ************************************** */
336
343
344
345 /* ** PadicoConnector ************************************ */
346
352 {
356 int (*connector_new)(void*_status, const void**local_addr, size_t*addr_size);
360 int (*connector_connect)(void*_status, const void*remote_addr, size_t addr_size);
363 };
365
366
367 /* ** PadicoBootstrap ************************************ */
368
372 {
374 int (*bootstrap_new) (void*_status);
376 int (*bootstrap_connect)(void*_status, const char*hostname, padico_topo_uuid_t uuid);
377 };
379
380
381 /* ** ControlSelector ************************************ */
382
390
391
395#include "na-Group.h"
396
397
398#ifdef __cplusplus
399} /* extern "C" */
400#endif
401
402#endif /* PADICO_REMOTECONTROL_H */
const const struct ns_rule_bucket_s * key
#define PADICO_LAST_MODULE_NAME
PUK_IFACE_TYPE(ProxyFactory, struct padico_proxyfactory_s)
return NULL
Definition Shm.h:88
PUK_MOD_AUTO_DEP(SysIO, PADICO_LAST_MODULE_NAME)
padico_topo_host_t const char * uuid
static bench_buffer_list_t l
Definition bench_list.c:27
static struct sockaddr_in remote_addr
static struct sockaddr_in local_addr
static int done
Definition console-mod.c:49
padico_topo_node_vect_t nodes
puk_component_t selector
static int size
Definition datacheck.c:34
static int server()
Definition datacheck.c:179
struct iovec padico_control_msg_get_bytes(padico_control_msg_t msg)
get a (contiguous) copy of the content of the control message; caller takes ownership of the copy
Definition na-control.c:229
static void padico_control_new_node(puk_instance_t controler, padico_topo_node_t node)
void padico_control_msg_add_part(padico_control_msg_t msg, const void *text, size_t len)
add an attached binary part to a control message
Definition na-control.c:189
static void padico_control_send_async(padico_topo_node_t node, const char *cmd, padico_task_notifier_t notify, void *key)
Send an async request on the control channel.
static void padico_control_plug_controler(puk_instance_t controler, puk_instance_t server)
static void padico_control_plug_connector(puk_component_t connector)
static void padico_control_event_enable(void)
struct padico_control_msg_s * padico_control_msg_t
void padico_control_gen_init_events(padico_event_listener_t l)
Generates initial events for new subscribers to get the current state.
Definition na-control.c:414
size_t padico_control_msg_get_size(padico_control_msg_t msg)
get the total number of bytes in the control message
Definition na-control.c:223
struct padico_control_event_s * padico_control_event_t
static void padico_control_send_oneway(padico_topo_node_t node, const char *msg)
Send a "one way" message on the control channel.
static void padico_control_event_disable(void)
static void padico_control_event_flush(void)
padico_string_t padico_control_msg_get_cmd(padico_control_msg_t msg)
Definition na-control.c:244
static padico_req_t padico_control_send(padico_topo_node_t node, const char *cmd)
Send a blocking request on the control channel.
static void padico_control_new_node_vect(puk_instance_t controler, padico_topo_node_vect_t nodes)
const struct iovec * padico_control_msg_get_iovec(padico_control_msg_t msg)
get an iovec from the control message content; caller takes ownership of iovec and must free it
Definition na-control.c:205
static void padico_control_event_unsubscribe(padico_event_listener_t l)
static void padico_control_event_subscribe(padico_event_listener_t l)
static void padico_control_unplug_controler(puk_instance_t controler)
static void padico_control_delete_node(puk_instance_t controler, padico_topo_node_t node)
static padico_topo_network_t padico_control_getnetwork(void)
Get the control channel as a network.
static void padico_control_unplug_connector(puk_component_t connector)
void padico_control_send_ext(padico_topo_node_t node, const char *cmd, uint32_t req_id)
Definition na-control.c:321
void padico_control_deliver_message(puk_instance_t controler, padico_topo_node_t from, char *cmd, size_t size)
deliver a message from a Controler
Definition na-control.c:388
static void padico_control_unplug_selector(puk_component_t selector)
int padico_control_send_msg(padico_topo_node_t node, padico_control_msg_t msg)
the real function to send a message on control channel- most of the time, we use a wraper,...
Definition na-control.c:252
static void padico_control_event_sync(void)
static void padico_control_plug_selector(puk_component_t selector)
int padico_control_msg_get_iovec_size(padico_control_msg_t msg)
get the number of iovec entries in the control message
Definition na-control.c:199
void padico_control_msg_destroy(padico_control_msg_t msg)
destroy a control message
Definition na-control.c:173
padico_tasklet_t padico_control_get_event_channel(void)
Definition na-control.c:402
padico_control_msg_t padico_control_msg_new(void)
create a new empty control message
Definition na-control.c:161
void(* padico_task_notifier_t)(padico_rc_t, void *)
Definition PadicoTM.h:139
padico_task_notifier_t notify
Definition PadicoTM.h:147
#define PADICO_REQ_ID_NONE
Definition PadicoTM.h:141
padico_req_t padico_tm_req_new(padico_task_notifier_t notifier, void *key)
void(* padico_event_listener_t)(void *event)
Definition tm-Tasks.h:48
padico_topo_network_t padico_topo_network_getbyid(const char *network_id)
Definition topology.c:2351
typdef struct padico_topo_node_vect_s * padico_topo_node_vect_t
Definition Topology.h:84
API for group management in PadicoTM NetAccess.
padico_topo_node_t node
Definition na-control.c:65
padico_req_id_t req_id
Definition na-control.c:66
mx_request_t req
Definition psp-mx.c:103
Interface: "PadicoBootstrap" Connection for PadicoControl with implicit address
int(* bootstrap_new)(void *_status)
create a new listening bootstrap endpoint.
int(* bootstrap_connect)(void *_status, const char *hostname, padico_topo_uuid_t uuid)
connect to a listening bootstrap endpoint
Interface: "PadicoConnector" Connection for PadicoControl with explicit address transfer.
int(* connector_connect)(void *_status, const void *remote_addr, size_t addr_size)
establishes a control connection to the remote given address The call is blocking.
void(* connector_close)(puk_context_t context)
close a connector context- may be NULL
int(* connector_init)(puk_context_t context)
initialize a new connector context- may be NULL
int(* connector_new)(void *_status, const void **local_addr, size_t *addr_size)
activate an instanciated connector
Interface: "PadicoControl".
void(* send_common)(void *_status, padico_topo_node_t node, padico_control_msg_t msg)
enum padico_control_event_s::padico_control_event_kind_e kind
struct padico_control_event_s::@47::@49 INIT_CONTROLER
padico_topo_node_t node
sender of this request
puk_instance_t controler
struct padico_control_event_s::@47::@55 UNPLUG_CONNECTOR
@ PADICO_CONTROL_EVENT_PLUG_CONTROLER
a new controler (PadicoControl) is loaded
@ PADICO_CONTROL_EVENT_SHUTDOWN
local node is shuting down, stop processing some events
@ PADICO_CONTROL_EVENT_INIT_CONTROLER
initial event sent to new controlers to get the past events and current topology state
@ PADICO_CONTROL_EVENT_UNPLUG_CONTROLER
a controler (PadicoControl) is unloaded
@ PADICO_CONTROL_EVENT_PLUG_SELECTOR
a new control selector (ControlSelector) is loaded
@ PADICO_CONTROL_EVENT_PLUG_CONNECTOR
a new connector (PadicoConnector) is loaded
@ PADICO_CONTROL_EVENT_UNPLUG_SELECTOR
a control selector (ControlSelector) is unloaded
@ PADICO_CONTROL_EVENT_DELETE_NODE
a node was deleted/disconnected/became unreachable
@ PADICO_CONTROL_EVENT_UNPLUG_CONNECTOR
a connector (PadicoConnector) is unloaded
@ PADICO_CONTROL_EVENT_NEW_NODE
a new node appeared in the known topology
size_t size
message size (including attachments)
struct padico_control_event_s::@47::@56 UNPLUG_SELECTOR
struct padico_control_event_s::@47::@54 UNPLUG_CONTROLER
struct padico_control_event_s::@47::@51 PLUG_CONTROLER
struct padico_control_event_s::@47::@53 PLUG_SELECTOR
puk_component_t connector
puk_component_t selector
char * cmd
msg of the request
struct padico_control_event_s::@47::@57 PROCESSING
padico_topo_node_vect_t nodes
puk_instance_t server
the server instance that created the new controler; may be NULL
struct padico_control_event_s::@47::@52 PLUG_CONNECTOR
struct padico_control_event_s::@47::@50 NODE
A control message.
Definition na-control.c:57
Interface: "ControlSelector".
puk_instance_t(* router)(padico_topo_node_t node)
returns an instance with a PadicoControl facet
a tasklet descriptor
a network, containing entities with bindings
Node UUID, in plain text (hex encoding)
marcel_cond_t event
Definition tm-boot.c:65
void padico_tasklet_unsubscribe(padico_tasklet_t t, padico_event_listener_t f)
Remove an event listener from a tasklet.
void padico_tasklet_flush(padico_tasklet_t t)
void padico_tasklet_schedule(padico_tasklet_t t, void *data, const char *name)
schedule a new task item to the tasklet
void padico_tasklet_release(padico_tasklet_t t)
release tasklet ownership from the current thread
void padico_tasklet_acquire(padico_tasklet_t t)
acquire tasklet ownership for the current thread
void padico_tasklet_subscribe(padico_tasklet_t t, padico_event_listener_t f)
Add an event listener to the tasklet.