2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 * Julien Desfossez <julien.desfossez@polymtl.ca>
4 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * This header is meant for liblttng and libust internal use ONLY. These
22 * declarations should NOT be considered stable API.
25 #ifndef _LTTNG_SESSIOND_COMM_H
26 #define _LTTNG_SESSIOND_COMM_H
29 #include <lttng/lttng.h>
30 #include <lttng/snapshot-internal.h>
31 #include <lttng/save-internal.h>
32 #include <lttng/channel-internal.h>
33 #include <lttng/trigger/trigger-internal.h>
34 #include <lttng/rotate-internal.h>
35 #include <common/compat/socket.h>
36 #include <common/uri.h>
37 #include <common/defaults.h>
38 #include <common/compat/uuid.h>
40 #include <arpa/inet.h>
41 #include <netinet/in.h>
46 #include <common/unix.h>
48 /* Queue size of listen(2) */
49 #define LTTNG_SESSIOND_COMM_MAX_LISTEN 64
51 /* Maximum number of FDs that can be sent over a Unix socket */
52 #define LTTCOMM_MAX_SEND_FDS 4
55 * Get the error code index from 0 since LTTCOMM_OK start at 1000
57 #define LTTCOMM_ERR_INDEX(code) (code - LTTCOMM_CONSUMERD_COMMAND_SOCK_READY)
59 enum lttcomm_sessiond_command
{
61 LTTNG_ADD_CONTEXT
= 0,
62 /* LTTNG_CALIBRATE used to be here */
63 LTTNG_DISABLE_CHANNEL
= 2,
64 LTTNG_DISABLE_EVENT
= 3,
65 LTTNG_LIST_SYSCALLS
= 4,
66 LTTNG_ENABLE_CHANNEL
= 5,
67 LTTNG_ENABLE_EVENT
= 6,
69 /* Session daemon command */
70 LTTNG_CREATE_SESSION
= 8,
71 LTTNG_DESTROY_SESSION
= 9,
72 LTTNG_LIST_CHANNELS
= 10,
73 LTTNG_LIST_DOMAINS
= 11,
74 LTTNG_LIST_EVENTS
= 12,
75 LTTNG_LIST_SESSIONS
= 13,
76 LTTNG_LIST_TRACEPOINTS
= 14,
77 LTTNG_REGISTER_CONSUMER
= 15,
78 LTTNG_START_TRACE
= 16,
79 LTTNG_STOP_TRACE
= 17,
80 LTTNG_LIST_TRACEPOINT_FIELDS
= 18,
83 LTTNG_DISABLE_CONSUMER
= 19,
84 LTTNG_ENABLE_CONSUMER
= 20,
85 LTTNG_SET_CONSUMER_URI
= 21,
88 LTTNG_DATA_PENDING
= 24,
89 LTTNG_SNAPSHOT_ADD_OUTPUT
= 25,
90 LTTNG_SNAPSHOT_DEL_OUTPUT
= 26,
91 LTTNG_SNAPSHOT_LIST_OUTPUT
= 27,
92 LTTNG_SNAPSHOT_RECORD
= 28,
93 LTTNG_CREATE_SESSION_SNAPSHOT
= 29,
94 LTTNG_CREATE_SESSION_LIVE
= 30,
95 LTTNG_SAVE_SESSION
= 31,
97 LTTNG_UNTRACK_PID
= 33,
98 LTTNG_LIST_TRACKER_PIDS
= 34,
99 LTTNG_SET_SESSION_SHM_PATH
= 40,
100 LTTNG_REGENERATE_METADATA
= 41,
101 LTTNG_REGENERATE_STATEDUMP
= 42,
102 LTTNG_REGISTER_TRIGGER
= 43,
103 LTTNG_UNREGISTER_TRIGGER
= 44,
104 LTTNG_ROTATE_SESSION
= 45,
105 LTTNG_ROTATION_GET_INFO
= 46,
106 LTTNG_ROTATION_SET_SCHEDULE
= 47,
107 LTTNG_SESSION_LIST_ROTATION_SCHEDULES
= 48,
110 enum lttcomm_relayd_command
{
111 RELAYD_ADD_STREAM
= 1,
112 RELAYD_CREATE_SESSION
= 2,
113 RELAYD_START_DATA
= 3,
114 RELAYD_UPDATE_SYNC_INFO
= 4,
116 RELAYD_SEND_METADATA
= 6,
117 RELAYD_CLOSE_STREAM
= 7,
118 RELAYD_DATA_PENDING
= 8,
119 RELAYD_QUIESCENT_CONTROL
= 9,
120 RELAYD_BEGIN_DATA_PENDING
= 10,
121 RELAYD_END_DATA_PENDING
= 11,
122 RELAYD_ADD_INDEX
= 12,
123 RELAYD_SEND_INDEX
= 13,
124 RELAYD_CLOSE_INDEX
= 14,
125 /* Live-reading commands (2.4+). */
126 RELAYD_LIST_SESSIONS
= 15,
127 /* All streams of the channel have been sent to the relayd (2.4+). */
128 RELAYD_STREAMS_SENT
= 16,
129 /* Ask the relay to reset the metadata trace file (2.8+) */
130 RELAYD_RESET_METADATA
= 17,
131 /* Ask the relay to rotate a stream file (2.11+) */
132 RELAYD_ROTATE_STREAM
= 18,
133 /* Rename a chunk after the rotation is completed (2.11+) */
134 RELAYD_ROTATE_RENAME
= 19,
135 /* Check if a chunk has data pending (2.11+) */
136 RELAYD_ROTATE_PENDING
= 20,
137 /* Create a folder on the relayd FS (2.11+) */
142 * lttcomm error code.
144 enum lttcomm_return_code
{
145 LTTCOMM_CONSUMERD_SUCCESS
= 0, /* Everything went fine. */
146 LTTCOMM_CONSUMERD_COMMAND_SOCK_READY
= 1, /* Command socket ready */
147 LTTCOMM_CONSUMERD_SUCCESS_RECV_FD
, /* Success on receiving fds */
148 LTTCOMM_CONSUMERD_ERROR_RECV_FD
, /* Error on receiving fds */
149 LTTCOMM_CONSUMERD_ERROR_RECV_CMD
, /* Error on receiving command */
150 LTTCOMM_CONSUMERD_POLL_ERROR
, /* Error in polling thread */
151 LTTCOMM_CONSUMERD_POLL_NVAL
, /* Poll on closed fd */
152 LTTCOMM_CONSUMERD_POLL_HUP
, /* All fds have hungup */
153 LTTCOMM_CONSUMERD_EXIT_SUCCESS
, /* Consumerd exiting normally */
154 LTTCOMM_CONSUMERD_EXIT_FAILURE
, /* Consumerd exiting on error */
155 LTTCOMM_CONSUMERD_OUTFD_ERROR
, /* Error opening the tracefile */
156 LTTCOMM_CONSUMERD_SPLICE_EBADF
, /* EBADF from splice(2) */
157 LTTCOMM_CONSUMERD_SPLICE_EINVAL
, /* EINVAL from splice(2) */
158 LTTCOMM_CONSUMERD_SPLICE_ENOMEM
, /* ENOMEM from splice(2) */
159 LTTCOMM_CONSUMERD_SPLICE_ESPIPE
, /* ESPIPE from splice(2) */
160 LTTCOMM_CONSUMERD_ENOMEM
, /* Consumer is out of memory */
161 LTTCOMM_CONSUMERD_ERROR_METADATA
, /* Error with metadata. */
162 LTTCOMM_CONSUMERD_FATAL
, /* Fatal error. */
163 LTTCOMM_CONSUMERD_RELAYD_FAIL
, /* Error on remote relayd */
164 LTTCOMM_CONSUMERD_CHANNEL_FAIL
, /* Channel creation failed. */
165 LTTCOMM_CONSUMERD_CHAN_NOT_FOUND
, /* Channel not found. */
166 LTTCOMM_CONSUMERD_ALREADY_SET
, /* Resource already set. */
167 LTTCOMM_CONSUMERD_ROTATION_FAIL
, /* Rotation has failed. */
168 LTTCOMM_CONSUMERD_ROTATE_RENAME_FAILED
, /* Rotation rename has failed. */
169 LTTCOMM_CONSUMERD_ROTATION_PENDING_LOCAL_FAILED
, /* Rotation pending relay failed. */
170 LTTCOMM_CONSUMERD_ROTATION_PENDING_RELAY_FAILED
, /* Rotation pending relay failed. */
171 LTTCOMM_CONSUMERD_MKDIR_FAILED
, /* mkdir has failed. */
172 LTTCOMM_CONSUMERD_SNAPSHOT_FAILED
, /* snapshot has failed. */
174 /* MUST be last element */
175 LTTCOMM_NR
, /* Last element */
178 /* lttng socket protocol. */
179 enum lttcomm_sock_proto
{
185 * Index in the net_families array below. Please keep in sync!
187 enum lttcomm_sock_domain
{
192 enum lttcomm_metadata_command
{
193 LTTCOMM_METADATA_REQUEST
= 1,
197 * Commands sent from the consumerd to the sessiond to request if new metadata
198 * is available. This message is used to find the per UID _or_ per PID registry
199 * for the channel key. For per UID lookup, the triplet
200 * bits_per_long/uid/session_id is used. On lookup failure, we search for the
201 * per PID registry indexed by session id ignoring the other values.
203 struct lttcomm_metadata_request_msg
{
204 uint64_t session_id
; /* Tracing session id */
205 uint64_t session_id_per_pid
; /* Tracing session id for per-pid */
206 uint32_t bits_per_long
; /* Consumer ABI */
208 uint64_t key
; /* Metadata channel key. */
211 struct lttcomm_sockaddr
{
212 enum lttcomm_sock_domain type
;
214 struct sockaddr_in sin
;
215 struct sockaddr_in6 sin6
;
219 struct lttcomm_sock
{
221 enum lttcomm_sock_proto proto
;
222 struct lttcomm_sockaddr sockaddr
;
223 const struct lttcomm_proto_ops
*ops
;
227 * Relayd sock. Adds the protocol version to use for the communications with
230 struct lttcomm_relayd_sock
{
231 struct lttcomm_sock sock
;
236 struct lttcomm_net_family
{
238 int (*create
) (struct lttcomm_sock
*sock
, int type
, int proto
);
241 struct lttcomm_proto_ops
{
242 int (*bind
) (struct lttcomm_sock
*sock
);
243 int (*close
) (struct lttcomm_sock
*sock
);
244 int (*connect
) (struct lttcomm_sock
*sock
);
245 struct lttcomm_sock
*(*accept
) (struct lttcomm_sock
*sock
);
246 int (*listen
) (struct lttcomm_sock
*sock
, int backlog
);
247 ssize_t (*recvmsg
) (struct lttcomm_sock
*sock
, void *buf
, size_t len
,
249 ssize_t (*sendmsg
) (struct lttcomm_sock
*sock
, const void *buf
,
250 size_t len
, int flags
);
254 * Data structure received from lttng client to session daemon.
256 struct lttcomm_session_msg
{
257 uint32_t cmd_type
; /* enum lttcomm_sessiond_command */
258 struct lttng_session session
;
259 struct lttng_domain domain
;
263 char channel_name
[LTTNG_SYMBOL_NAME_LEN
];
264 struct lttng_event event LTTNG_PACKED
;
265 /* Length of following filter expression. */
266 uint32_t expression_len
;
267 /* Length of following bytecode for filter. */
268 uint32_t bytecode_len
;
269 /* Exclusion count (fixed-size strings). */
270 uint32_t exclusion_count
;
271 /* Userspace probe location size. */
272 uint32_t userspace_probe_location_len
;
274 * After this structure, the following variable-length
275 * items are transmitted:
276 * - char exclusion_names[LTTNG_SYMBOL_NAME_LEN][exclusion_count]
277 * - char filter_expression[expression_len]
278 * - unsigned char filter_bytecode[bytecode_len]
280 } LTTNG_PACKED enable
;
282 char channel_name
[LTTNG_SYMBOL_NAME_LEN
];
283 struct lttng_event event LTTNG_PACKED
;
284 /* Length of following filter expression. */
285 uint32_t expression_len
;
286 /* Length of following bytecode for filter. */
287 uint32_t bytecode_len
;
289 * After this structure, the following variable-length
290 * items are transmitted:
291 * - unsigned char filter_expression[expression_len]
292 * - unsigned char filter_bytecode[bytecode_len]
294 } LTTNG_PACKED disable
;
297 struct lttng_channel chan LTTNG_PACKED
;
298 /* struct lttng_channel_extended is already packed. */
299 struct lttng_channel_extended extended
;
300 } LTTNG_PACKED channel
;
303 char channel_name
[LTTNG_SYMBOL_NAME_LEN
];
304 struct lttng_event_context ctx LTTNG_PACKED
;
305 uint32_t provider_name_len
;
306 uint32_t context_name_len
;
307 } LTTNG_PACKED context
;
308 /* Use by register_consumer */
314 char channel_name
[LTTNG_SYMBOL_NAME_LEN
];
316 struct lttng_calibrate calibrate
;
317 /* Used by the set_consumer_url and used by create_session also call */
319 /* Number of lttng_uri following */
323 struct lttng_snapshot_output output LTTNG_PACKED
;
324 } LTTNG_PACKED snapshot_output
;
327 struct lttng_snapshot_output output LTTNG_PACKED
;
328 } LTTNG_PACKED snapshot_record
;
331 unsigned int timer_interval
; /* usec */
332 } LTTNG_PACKED session_live
;
334 struct lttng_save_session_attr attr
; /* struct already packed */
335 } LTTNG_PACKED save_session
;
337 char shm_path
[PATH_MAX
];
338 } LTTNG_PACKED set_shm_path
;
341 } LTTNG_PACKED pid_tracker
;
344 } LTTNG_PACKED trigger
;
346 uint64_t rotation_id
;
347 } LTTNG_PACKED get_rotation_info
;
349 /* enum lttng_rotation_schedule_type */
352 * If set == 1, set schedule to value, if set == 0,
353 * clear this schedule type.
357 } LTTNG_PACKED rotation_set_schedule
;
361 #define LTTNG_FILTER_MAX_LEN 65536
364 * Filter bytecode data. The reloc table is located at the end of the
365 * bytecode. It is made of tuples: (uint16_t, var. len. string). It
366 * starts at reloc_table_offset.
368 #define LTTNG_FILTER_PADDING 32
369 struct lttng_filter_bytecode
{
370 uint32_t len
; /* len of data */
371 uint32_t reloc_table_offset
;
373 char padding
[LTTNG_FILTER_PADDING
];
378 * Event exclusion data. At the end of the structure, there will actually
379 * by zero or more names, where the actual number of names is given by
380 * the 'count' item of the structure.
382 #define LTTNG_EVENT_EXCLUSION_PADDING 32
383 struct lttng_event_exclusion
{
385 char padding
[LTTNG_EVENT_EXCLUSION_PADDING
];
386 char names
[0][LTTNG_SYMBOL_NAME_LEN
];
389 #define LTTNG_EVENT_EXCLUSION_NAME_AT(_exclusion, _i) \
390 (&(_exclusion)->names[_i][0])
393 * Event command header.
395 struct lttcomm_event_command_header
{
396 /* Number of events */
401 * Event extended info header. This is the structure preceding each
402 * extended info data.
404 struct lttcomm_event_extended_header
{
406 * Size of filter string immediately following this header.
407 * This size includes the terminal null character.
412 * Number of exclusion names, immediately following the filter
413 * string. Each exclusion name has a fixed length of
414 * LTTNG_SYMBOL_NAME_LEN bytes, including the terminal null
417 uint32_t nb_exclusions
;
420 * Size of the event's userspace probe location (if applicable).
422 uint32_t userspace_probe_location_len
;
426 * Data structure for the response from sessiond to the lttng client.
428 struct lttcomm_lttng_msg
{
429 uint32_t cmd_type
; /* enum lttcomm_sessiond_command */
430 uint32_t ret_code
; /* enum lttcomm_return_code */
431 uint32_t pid
; /* pid_t */
432 uint32_t cmd_header_size
;
436 struct lttcomm_lttng_output_id
{
441 * lttcomm_consumer_msg is the message sent from sessiond to consumerd
442 * to either add a channel, add a stream, update a stream, or stop
445 struct lttcomm_consumer_msg
{
446 uint32_t cmd_type
; /* enum lttng_consumer_command */
449 uint64_t channel_key
;
451 char pathname
[PATH_MAX
];
455 /* nb_init_streams is the number of streams open initially. */
456 uint32_t nb_init_streams
;
457 char name
[LTTNG_SYMBOL_NAME_LEN
];
458 /* Use splice or mmap to consume this fd */
459 enum lttng_event_output output
;
460 int type
; /* Per cpu or metadata. */
461 uint64_t tracefile_size
; /* bytes */
462 uint32_t tracefile_count
; /* number of tracefiles */
463 /* If the channel's streams have to be monitored or not. */
465 /* timer to check the streams usage in live mode (usec). */
466 unsigned int live_timer_interval
;
467 /* timer to sample a channel's positions (usec). */
468 unsigned int monitor_timer_interval
;
469 } LTTNG_PACKED channel
; /* Only used by Kernel. */
472 uint64_t channel_key
;
473 int32_t cpu
; /* On which CPU this stream is assigned. */
474 /* Tells the consumer if the stream should be or not monitored. */
477 * The archive id that was "current" at the time this
478 * stream was created. This is used to determine
479 * whether a rotation request was sent before or after
480 * the creation of a stream.
482 uint64_t trace_archive_id
;
483 } LTTNG_PACKED stream
; /* Only used by Kernel. */
486 enum lttng_stream_type type
;
487 /* Open socket to the relayd */
488 struct lttcomm_relayd_sock sock
;
489 /* Tracing session id associated to the relayd. */
491 /* Relayd session id, only used with control socket. */
492 uint64_t relayd_session_id
;
493 } LTTNG_PACKED relayd_sock
;
495 uint64_t net_seq_idx
;
496 } LTTNG_PACKED destroy_relayd
;
499 } LTTNG_PACKED data_pending
;
501 uint64_t subbuf_size
; /* bytes */
502 uint64_t num_subbuf
; /* power of 2 */
503 int32_t overwrite
; /* 1: overwrite, 0: discard */
504 uint32_t switch_timer_interval
; /* usec */
505 uint32_t read_timer_interval
; /* usec */
506 unsigned int live_timer_interval
; /* usec */
507 uint32_t monitor_timer_interval
; /* usec */
508 int32_t output
; /* splice, mmap */
509 int32_t type
; /* metadata or per_cpu */
510 uint64_t session_id
; /* Tracing session id */
511 char pathname
[PATH_MAX
]; /* Channel file path. */
512 char name
[LTTNG_SYMBOL_NAME_LEN
]; /* Channel name. */
513 uint32_t uid
; /* User ID of the session */
514 uint32_t gid
; /* Group ID ot the session */
515 uint64_t relayd_id
; /* Relayd id if apply. */
516 uint64_t key
; /* Unique channel key. */
517 unsigned char uuid
[UUID_LEN
]; /* uuid for ust tracer. */
518 uint32_t chan_id
; /* Channel ID on the tracer side. */
519 uint64_t tracefile_size
; /* bytes */
520 uint32_t tracefile_count
; /* number of tracefiles */
521 uint64_t session_id_per_pid
; /* Per-pid session ID. */
522 /* Tells the consumer if the stream should be or not monitored. */
525 * For UST per UID buffers, this is the application UID of the
526 * channel. This can be different from the user UID requesting the
527 * channel creation and used for the rights on the stream file
528 * because the application can be in the tracing for instance.
530 uint32_t ust_app_uid
;
531 int64_t blocking_timeout
;
533 * The archive id that was "current" at the time this
534 * channel was created. This is used to determine
535 * whether a rotation request was sent before or after
536 * the creation of a channel.
538 uint64_t trace_archive_id
;
539 char root_shm_path
[PATH_MAX
];
540 char shm_path
[PATH_MAX
];
541 } LTTNG_PACKED ask_channel
;
544 } LTTNG_PACKED get_channel
;
547 } LTTNG_PACKED destroy_channel
;
549 uint64_t key
; /* Metadata channel key. */
550 uint64_t target_offset
; /* Offset in the consumer */
551 uint64_t len
; /* Length of metadata to be received. */
552 uint64_t version
; /* Version of the metadata. */
553 } LTTNG_PACKED push_metadata
;
555 uint64_t key
; /* Metadata channel key. */
556 } LTTNG_PACKED close_metadata
;
558 uint64_t key
; /* Metadata channel key. */
559 } LTTNG_PACKED setup_metadata
;
561 uint64_t key
; /* Channel key. */
562 } LTTNG_PACKED flush_channel
;
564 uint64_t key
; /* Channel key. */
565 } LTTNG_PACKED clear_quiescent_channel
;
567 char pathname
[PATH_MAX
];
568 /* Indicate if the snapshot goes on the relayd or locally. */
570 uint32_t metadata
; /* This a metadata snapshot. */
571 uint64_t relayd_id
; /* Relayd id if apply. */
573 uint64_t nb_packets_per_stream
;
575 * The session's current trace archive id is propagated
576 * since a snapshot triggers the creation of an
577 * ephemeral metadata stream.
579 uint64_t trace_archive_id
;
580 } LTTNG_PACKED snapshot_channel
;
582 uint64_t channel_key
;
583 uint64_t net_seq_idx
;
584 } LTTNG_PACKED sent_streams
;
587 uint64_t channel_key
;
588 } LTTNG_PACKED discarded_events
;
591 uint64_t channel_key
;
592 } LTTNG_PACKED lost_packets
;
595 } LTTNG_PACKED regenerate_metadata
;
597 char pathname
[PATH_MAX
];
598 uint32_t metadata
; /* This is a metadata channel. */
599 uint64_t relayd_id
; /* Relayd id if apply. */
601 uint64_t new_chunk_id
;
602 } LTTNG_PACKED rotate_channel
;
604 char old_path
[LTTNG_PATH_MAX
];
605 char new_path
[LTTNG_PATH_MAX
];
606 uint64_t relayd_id
; /* Relayd id if apply. */
610 } LTTNG_PACKED rotate_rename
;
614 } LTTNG_PACKED check_rotation_pending_local
;
619 } LTTNG_PACKED check_rotation_pending_relay
;
621 char path
[LTTNG_PATH_MAX
];
622 uint64_t relayd_id
; /* Relayd id if apply. */
626 } LTTNG_PACKED mkdir
;
631 * Channel monitoring message returned to the session daemon on every
632 * monitor timer expiration.
634 struct lttcomm_consumer_channel_monitor_msg
{
635 /* Key of the sampled channel. */
638 * Lowest and highest usage (bytes) at the moment the sample was taken.
640 uint64_t lowest
, highest
;
642 * Sum of all the consumed positions for a channel.
644 uint64_t total_consumed
;
648 * Status message returned to the sessiond after a received command.
650 struct lttcomm_consumer_status_msg
{
651 enum lttcomm_return_code ret_code
;
654 struct lttcomm_consumer_status_channel
{
655 enum lttcomm_return_code ret_code
;
657 unsigned int stream_count
;
660 #ifdef HAVE_LIBLTTNG_UST_CTL
662 #include <lttng/ust-abi.h>
665 * Data structure for the commands sent from sessiond to UST.
667 struct lttcomm_ust_msg
{
671 struct lttng_ust_channel channel
;
672 struct lttng_ust_stream stream
;
673 struct lttng_ust_event event
;
674 struct lttng_ust_context context
;
675 struct lttng_ust_tracer_version version
;
680 * Data structure for the response from UST to the session daemon.
681 * cmd_type is sent back in the reply for validation.
683 struct lttcomm_ust_reply
{
686 uint32_t ret_code
; /* enum lttcomm_return_code */
687 uint32_t ret_val
; /* return value */
690 uint64_t memory_map_size
;
691 } LTTNG_PACKED channel
;
693 uint64_t memory_map_size
;
694 } LTTNG_PACKED stream
;
695 struct lttng_ust_tracer_version version
;
699 #endif /* HAVE_LIBLTTNG_UST_CTL */
701 LTTNG_HIDDEN
const char *lttcomm_get_readable_code(enum lttcomm_return_code code
);
703 LTTNG_HIDDEN
int lttcomm_init_inet_sockaddr(struct lttcomm_sockaddr
*sockaddr
,
704 const char *ip
, unsigned int port
);
705 LTTNG_HIDDEN
int lttcomm_init_inet6_sockaddr(struct lttcomm_sockaddr
*sockaddr
,
706 const char *ip
, unsigned int port
);
708 LTTNG_HIDDEN
struct lttcomm_sock
*lttcomm_alloc_sock(enum lttcomm_sock_proto proto
);
709 LTTNG_HIDDEN
int lttcomm_create_sock(struct lttcomm_sock
*sock
);
710 LTTNG_HIDDEN
struct lttcomm_sock
*lttcomm_alloc_sock_from_uri(struct lttng_uri
*uri
);
711 LTTNG_HIDDEN
void lttcomm_destroy_sock(struct lttcomm_sock
*sock
);
712 LTTNG_HIDDEN
struct lttcomm_sock
*lttcomm_alloc_copy_sock(struct lttcomm_sock
*src
);
713 LTTNG_HIDDEN
void lttcomm_copy_sock(struct lttcomm_sock
*dst
,
714 struct lttcomm_sock
*src
);
716 /* Relayd socket object. */
717 LTTNG_HIDDEN
struct lttcomm_relayd_sock
*lttcomm_alloc_relayd_sock(
718 struct lttng_uri
*uri
, uint32_t major
, uint32_t minor
);
720 LTTNG_HIDDEN
int lttcomm_setsockopt_rcv_timeout(int sock
, unsigned int msec
);
721 LTTNG_HIDDEN
int lttcomm_setsockopt_snd_timeout(int sock
, unsigned int msec
);
723 LTTNG_HIDDEN
int lttcomm_sock_get_port(const struct lttcomm_sock
*sock
,
726 * Set a port to an lttcomm_sock. This will have no effect is the socket is
729 LTTNG_HIDDEN
int lttcomm_sock_set_port(struct lttcomm_sock
*sock
, uint16_t port
);
731 LTTNG_HIDDEN
void lttcomm_init(void);
732 /* Get network timeout, in milliseconds */
733 LTTNG_HIDDEN
unsigned long lttcomm_get_network_timeout(void);
735 #endif /* _LTTNG_SESSIOND_COMM_H */