PadicoTM

Documentation

« back to PM2 home.
secondary-connector.c
Go to the documentation of this file.
1/*
2 * Padico -- a High Performance Parallel and Distributed Computing Environment
3 * Copyright (c) 2002-2025 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
30#include <Padico/Puk.h>
31#include <Padico/Module.h>
32#include <Padico/PadicoTM.h>
33#include <Padico/Topology.h>
34#include <Padico/PadicoControl.h>
35#include <Padico/AddrDB.h>
36
37static int padico_secondary_connector_init(void);
38
40
50/* ********************************************************* */
51
53static void secondary_connector_destroy(void*_status);
54
60
61static int secondary_connector_new(void*_status, const void**local_addr, size_t*addr_size);
62static int secondary_connector_connect(void*_status, const void*remote_addr, size_t addr_size);
63
69
74
77/* ********************************************************* */
78
80{
81 puk_component_declare("SecondaryConnector",
82 puk_component_provides("PadicoComponent", "component", &secondary_connector_component_driver),
83 puk_component_provides("PadicoConnector", "connector", &secondary_connector_driver),
84 puk_component_uses("PadicoBootstrap", "bootstrap"));
85 return 0;
86}
87
88/* ********************************************************* */
89
96static void secondary_connector_destroy(void*_status)
97{
98 padico_free(_status);
99}
100
101/* ********************************************************* */
102
103static int secondary_connector_new(void*_status, const void**local_addr, size_t*addr_size)
104{
105 const char*uuid = (const char*)padico_topo_node_getuuid(padico_topo_getlocalnode());
106 *local_addr = uuid;
107 *addr_size = PADICO_TOPO_UUID_SIZE + 1;
108 return 0;
109}
110
111static int secondary_connector_connect(void*_status, const void*remote_addr, size_t addr_size)
112{
113 struct secondary_connector_status_s*status = _status;
114 padico_print("connect- local=%s; remote=%s\n",
116 (char*)remote_addr);
117 int rc = 0;
119 if(is_server)
120 {
121 padico_print("bootstrap_new\n");
122 rc = status->bootstrap.driver->bootstrap_new(status->bootstrap._status);
123 padico_print("bootstrap_new done.\n");
124 }
125 else
126 {
127 padico_print("bootstrap_connect\n");
131 const char*hostname = padico_topo_host_getname(host);
132 rc = status->bootstrap.driver->bootstrap_connect(status->bootstrap._status, hostname, uuid);
133 padico_print("bootstrap_connect- done\n");
134 }
135 return rc;
136}
static int is_server
return NULL
Definition Shm.h:88
padico_topo_host_t host
padico_topo_host_t const char * uuid
static struct sockaddr_in remote_addr
static struct sockaddr_in local_addr
static int done
Definition console-mod.c:49
puk_instance_t instance
the listening bootstrap instance
static void puk_instance_context_indirect_PadicoBootstrap(puk_instance_t instance, const char *label, struct puk_receptacle_PadicoBootstrap_s *receptacle)
padico_rc_t rc
Definition PadicoTM.h:146
static const struct padico_control_connector_driver_s secondary_connector_driver
static int secondary_connector_new(void *_status, const void **local_addr, size_t *addr_size)
static void * secondary_connector_instantiate(puk_instance_t instance, puk_context_t context)
static int secondary_connector_connect(void *_status, const void *remote_addr, size_t addr_size)
static void secondary_connector_destroy(void *_status)
static const struct puk_component_driver_s secondary_connector_component_driver
padico_topo_node_t padico_topo_getlocalnode(void)
Definition topology.c:1891
#define PADICO_TOPO_UUID_SIZE
Definition Topology.h:73
padico_topo_host_t padico_topo_node_gethost(padico_topo_node_t node)
Get the host hosting a node.
Definition topology.c:1927
padico_topo_uuid_t padico_topo_node_getuuid(padico_topo_node_t node)
Get the UUID of a node.
Definition topology.c:1912
padico_topo_node_t padico_topo_getnodebyuuid(padico_topo_uuid_t uuid)
node lookup, by UUID
Definition topology.c:2407
const char * padico_topo_host_getname(padico_topo_host_t host)
Get the canonical name of a host.
Definition topology.c:1944
padico_topo_node_t node
Definition na-control.c:65
static int padico_secondary_connector_init(void)
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_new)(void *_status, const void **local_addr, size_t *addr_size)
activate an instanciated connector
struct padico_bootstrap_driver_s * driver
struct puk_receptacle_PadicoBootstrap_s bootstrap
Node UUID, in plain text (hex encoding)