PadicoTM

Documentation

« back to PM2 home.
VLink-Packet.h
Go to the documentation of this file.
1/*
2 * Padico -- a High Performance Parallel and Distributed Computing Environment
3 * Copyright (c) 2002-2023 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/PadicoTM.h>
32#include <Padico/PM2.h>
33#include <Padico/Topology.h>
34#include <Padico/PSP.h>
35#include <Padico/VLink-internals.h>
36
37
38/* *** Types *********************************************** */
39
56#define AF_PADICO_VOPW AF_PADICO_MAGIC('V', 'O', 'P', 'W')
57
58/* *** iboxes ********************************************** */
59
63{
64 char*data;
65 size_t total_size;
66 size_t offset;
67 size_t size;
68};
69
73 int what;
78 );
79
80/* *** iboxes types */
81
82#define VOPW_IBOX_DATA 0x01
83#define VOPW_IBOX_RENDEZVOUS 0x02
84#define VOPW_IBOX_OKTOSEND 0x04
85#define VOPW_IBOX_PACKET 0x08
86#define VOPW_IBOX_EOS 0x10
87
88
89/* *** Buffer management *********************************** */
90
91#define VOPW_BUF_MEMTOBUFFER(BUF, MEM, SIZ) \
92 { memcpy((BUF).data+(BUF).size, (MEM), (SIZ)); \
93 (BUF).size += (SIZ); }
94
95#define VOPW_BUF_PUMPTOBUFFER(BUF, SIZ, TOKEN, PUMP) \
96 { (*(PUMP))((TOKEN), ((BUF).data +(BUF).size), (SIZ)); \
97 (BUF).size += (SIZ); }
98
99#define VOPW_BUF_BUFFERTOMEM(MEM, BUF, SIZ) \
100 { memcpy(MEM, (BUF).data+(BUF).offset, SIZ); \
101 (BUF).offset += SIZ; }
102
103#define VOPW_BUF_ALLOC(BUF, SIZ) \
104 { (BUF).data=padico_malloc(SIZ); \
105 (BUF).offset=0; \
106 (BUF).size=0; \
107 (BUF).total_size=(SIZ); }
108
109#define VOPW_BUF_CURRENTSIZE(BUF) \
110 ((BUF).size-(BUF).offset)
111
112#define VOPW_BUF_FREE(BUF) \
113 padico_free((BUF).data)
114
115
116/* *** Tags management ************************************* */
117
118/* maximum number of simultaneously opened vsocks */
119#ifdef PUKABI
120#define VOPW_VNODES_MAX PUK_ABI_FD_MAX
121#else /* PUKABI */
122#define VOPW_VNODES_MAX 256
123#endif /* PUKABI */
124#define VOPW_TAG_NOTAG -1
125#define VOPW_TAG_ANY 0
126#define VOPW_TAG_FIRST 1
127#define VOPW_TAG_LAST (VOPW_VNODES_MAX-1)
128#define VOPW_TAG_NEXT(T) (((T)==VOPW_TAG_LAST)?(VOPW_TAG_FIRST):((T)+1))
129
130/* *** Dynamic node resolution ***************************** */
131
140
149
150/* *** "on the wire" operations **************************** */
151
152/* used only for deferred requests */
153#define VOPW_OP_NONE 0x00
154
155#define VOPW_OP_CONNECT 0x01
165
166#define VOPW_OP_CONNREFUSED 0x02
167
168#define VOPW_OP_ACCEPTED 0x03
174
175#define VOPW_OP_CLOSE 0x04 /* the sender will not receive anymore */
176
177#define VOPW_OP_EOS 0x05 /* end-of-stream: the sender will not send anymore */
178
179#define VOPW_OP_GET_TAG 0x06 /* Port-to-tag resolution request */
186
187#define VOPW_OP_GIVE_TAG 0x07 /* Port-to-tag resolution reply */
195
196#define VOPW_OP_DATA 0x11 /* streamed data */
203
204#define VOPW_OP_RENDEZVOUS 0x12
210
211#define VOPW_OP_OKTOSEND 0x14
216
217#define VOPW_OP_PACKET 0x15 /* packet-based data */
224
245
246
252{
253 int op; /* VOPW_OP_NONE: no default header- full header given instead in field 'hdr' */
static int done
Definition console-mod.c:49
#define PADICO_TOPO_UUID_SIZE
Definition Topology.h:73
virtual node descriptor, common to any file type
Definition VLink-API.h:383
Serialized form of a vopw_address_s (in network byte order)
Address for a VLink_Packet endpoint.
uint16_t tag
tag which uniquely identifies the virtual socket
padico_topo_node_t na_node
node descriptor
automatic buffers with sliding pointers
size_t total_size
size of the 'data' buffer
char * data
beginning of the data buffer
Structure to describe deferred operations to be executed in a different thread than the receiving one...
struct vopw_hdr_s hdr
padico_topo_node_t dest_node
padico_vnode_t vnode
uint16_t tag
uint32_t addr
uint16_t port
uint32_t rank
Dynamic address resolution manager.
vopw_dynres_vect_t cache
cache of known addresses
pthread_mutex_t lock
lock for the cache access
pthread_cond_t cond
monitor events in the cache
uint32_t my_addr
IP address of the server.
uint16_t my_tag
tag for the newly created socket
uint16_t my_tag
tag of the client side
uint16_t domain
domain of the virtual socket.
uint16_t type
SOCK_STREAM, SOCK_DGRAM.
uint32_t my_addr
IP address of the client side.
uint16_t your_tag
tag of the server socket
char data[4]
place holder for a pointer- actually, more space is used
uint32_t len
length of data (including data in header)
uint32_t tlen
length of data in message body
uint16_t your_port
port number requested
uint16_t type
SOCK_STREAM, SOCK_DGRAM.
uint32_t accepted_len
accepted_len <= proposed_len - DATA_IN_HEADER
uint16_t port
port from where the packet is sent
char data[4]
place-holder for actual data
uint32_t len
length of data (including data in header)
uint32_t proposed_len
length of the data ready to be sent
Header for all outgoing messages through VSock/Madeleine wrapper.
union vopw_hdr_s::vopw_hdr_info_u info
variable part of the header
uint16_t op
operator code
uint16_t tag
destination MAD tag
struct vopw_hdr_info_data_s DATA
struct vopw_hdr_info_oktosend_s OKTOSEND
struct vopw_hdr_info_connect_s CONNECT
struct vopw_hdr_info_givetag_s GIVETAG
struct vopw_hdr_info_gettag_s GETTAG
struct vopw_hdr_info_packet_s PACKET
struct vopw_hdr_info_rendezvous_s RENDEZVOUS
struct vopw_hdr_info_accepted_s ACCEPTED