libzmq
src
pgm_socket.hpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MPL-2.0 */
2
3
#ifndef __PGM_SOCKET_HPP_INCLUDED__
4
#define __PGM_SOCKET_HPP_INCLUDED__
5
6
#if defined ZMQ_HAVE_OPENPGM
7
8
#ifdef ZMQ_HAVE_WINDOWS
9
#define __PGM_WININT_H__
10
#endif
11
12
#include <pgm/pgm.h>
13
14
#if defined(ZMQ_HAVE_OSX) || defined(ZMQ_HAVE_NETBSD)
15
#include <pgm/in.h>
16
#endif
17
18
#include "
fd.hpp
"
19
#include "
options.hpp
"
20
21
namespace
zmq
22
{
23
// Encapsulates PGM socket.
24
class
pgm_socket_t
25
{
26
public
:
27
// If receiver_ is true PGM transport is not generating SPM packets.
28
pgm_socket_t (
bool
receiver_,
const
options_t &
options_
);
29
30
// Closes the transport.
31
~pgm_socket_t ();
32
33
// Initialize PGM network structures (GSI, GSRs).
34
int
init
(
bool
udp_encapsulation_,
const
char
*network_);
35
36
// Resolve PGM socket address.
37
static
int
init_address (
const
char
*network_,
38
struct
pgm_addrinfo_t **addr,
39
uint16_t *port_number);
40
41
// Get receiver fds and store them into user allocated memory.
42
void
get_receiver_fds (
fd_t
*receive_fd_,
fd_t
*waiting_pipe_fd_);
43
44
// Get sender and receiver fds and store it to user allocated
45
// memory. Receive fd is used to process NAKs from peers.
46
void
get_sender_fds (
fd_t
*send_fd_,
47
fd_t
*receive_fd_,
48
fd_t
*rdata_notify_fd_,
49
fd_t
*pending_notify_fd_);
50
51
// Send data as one APDU, transmit window owned memory.
52
size_t
send
(
unsigned
char
*
data_
,
size_t
data_len_);
53
54
// Returns max tsdu size without fragmentation.
55
size_t
get_max_tsdu_size ();
56
57
// Receive data from pgm socket.
58
ssize_t
receive
(
void
**
data_
,
const
pgm_tsi_t **tsi_);
59
60
long
get_rx_timeout ();
61
long
get_tx_timeout ();
62
63
// POLLIN on sender side should mean NAK or SPMR receiving.
64
// process_upstream function is used to handle such a situation.
65
void
process_upstream ();
66
67
private
:
68
// Compute size of the buffer based on rate and recovery interval.
69
int
compute_sqns (
int
tpdu_);
70
71
// OpenPGM transport.
72
pgm_sock_t *
sock
;
73
74
int
last_rx_status, last_tx_status;
75
76
// Associated socket options.
77
options_t
options
;
78
79
// true when pgm_socket should create receiving side.
80
bool
receiver
;
81
82
// Array of pgm_msgv_t structures to store received data
83
// from the socket (pgm_transport_recvmsgv).
84
pgm_msgv_t *pgm_msgv;
85
86
// Size of pgm_msgv array.
87
size_t
pgm_msgv_len;
88
89
// How many bytes were read from pgm socket.
90
size_t
nbytes_rec;
91
92
// How many bytes were processed from last pgm socket read.
93
size_t
nbytes_processed;
94
95
// How many messages from pgm_msgv were already sent up.
96
size_t
pgm_msgv_processed;
97
};
98
}
99
#endif
100
101
#endif
init
WEPOLL_INTERNAL int init(void)
Definition:
wepoll.c:858
data_
StringPiece data_
Definition:
bytestream_unittest.cc:60
receive
int receive(void *socket_, int *is_termination_)
Definition:
test_hwm_pubsub.cpp:62
options
Message * options
Definition:
src/google/protobuf/descriptor.cc:3119
sock
void * sock
Definition:
test_connect_resolve.cpp:9
send
void send(fd_t fd_, const char(&data_)[N])
Definition:
test_security_curve.cpp:209
zmq
Definition:
zmq.hpp:229
fd.hpp
options.hpp
receiver
static void receiver(void *socket_)
Definition:
test_ctx_destroy.cpp:16
fd_t
zmq_fd_t fd_t
Definition:
libzmq/tests/testutil.hpp:98
options_
DebugStringOptions options_
Definition:
src/google/protobuf/descriptor.cc:2410
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:57