stumpless 2.2.0
Loading...
Searching...
No Matches
network.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: Apache-2.0 */
2
3/*
4 * Copyright 2018-2022 Joel E. Anderson
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
39#ifndef __STUMPLESS_TARGET_NETWORK_H
40# define __STUMPLESS_TARGET_NETWORK_H
41
42# include <stddef.h>
43# include <stumpless/config.h>
44# include <stumpless/target.h>
45
53#define STUMPLESS_DEFAULT_TRANSPORT_PORT "514"
54
63#define STUMPLESS_DEFAULT_UDP_MAX_MESSAGE_SIZE 1472
64
65# ifdef __cplusplus
66extern "C" {
67# endif
68
76
84
109void
111
144const char *
146
177const char *
179
202size_t
204
239struct stumpless_target *
241 enum stumpless_network_protocol network,
242 enum stumpless_transport_protocol transport );
243
274struct stumpless_target *
276
307struct stumpless_target *
309
340struct stumpless_target *
342
373struct stumpless_target *
375
411struct stumpless_target *
413 const char *destination,
414 enum stumpless_network_protocol network,
415 enum stumpless_transport_protocol transport );
416
446struct stumpless_target *
447stumpless_open_tcp4_target( const char *name, const char *destination );
448
478struct stumpless_target *
479stumpless_open_tcp6_target( const char *name, const char *destination );
480
508struct stumpless_target *
509stumpless_open_udp4_target( const char *name, const char *destination );
510
538struct stumpless_target *
539stumpless_open_udp6_target( const char *name, const char *destination );
540
579struct stumpless_target *
581 const char *destination );
582
627struct stumpless_target *
629 const char *port );
630
668struct stumpless_target *
670 size_t max_msg_size );
671
698
724
725# ifdef __cplusplus
726} /* extern "C" */
727# endif
728#endif /* __STUMPLESS_TARGET_NETWORK_H */
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
Definition config.h:31
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_udp6_target(const char *name, const char *destination)
Opens a network target for remote logging over IPv6 and UDP.
STUMPLESS_PUBLIC_FUNCTION void stumpless_close_network_target(const struct stumpless_target *target)
Closes a network target.
stumpless_transport_protocol
Transport protocols used by a network target.
Definition network.h:80
@ STUMPLESS_UDP_TRANSPORT_PROTOCOL
UDP, RFC 768.
Definition network.h:82
@ STUMPLESS_TCP_TRANSPORT_PROTOCOL
TCP, RFC 793.
Definition network.h:81
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_network_target(const char *name, const char *destination, enum stumpless_network_protocol network, enum stumpless_transport_protocol transport)
Opens a network target.
STUMPLESS_PUBLIC_FUNCTION size_t stumpless_get_udp_max_message_size(const struct stumpless_target *target)
Gets the current maximum message size of a UDP network target.
STUMPLESS_PUBLIC_FUNCTION enum stumpless_network_protocol stumpless_get_network_protocol(const struct stumpless_target *target)
Gets the network protocol of a network target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_udp4_target(const char *name, const char *destination)
Opens a network target for remote logging over IPv4 and UDP.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_set_transport_port(struct stumpless_target *target, const char *port)
Sets the transport port number of a network target.
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_transport_port(const struct stumpless_target *target)
Gets the transport port number of a network target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_new_udp6_target(const char *name)
Creates a network target for logging over IPv6 and UDP, but does not open it.
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_destination(const struct stumpless_target *target)
Gets the destination of a network target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_tcp4_target(const char *name, const char *destination)
Opens a network target for remote logging over IPv4 and TCP.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_new_tcp6_target(const char *name)
Creates a network target for logging over IPv6 and TCP, but does not open it.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_set_destination(struct stumpless_target *target, const char *destination)
Sets the destination of a network target.
stumpless_network_protocol
Network protocols used by a network target.
Definition network.h:72
@ STUMPLESS_IPV6_NETWORK_PROTOCOL
Internet Protocl version 6, RFC 8200.
Definition network.h:74
@ STUMPLESS_IPV4_NETWORK_PROTOCOL
Internet Protocol version 4, RFC 791.
Definition network.h:73
STUMPLESS_PUBLIC_FUNCTION enum stumpless_transport_protocol stumpless_get_transport_protocol(const struct stumpless_target *target)
Gets the transport protocol of a network target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_new_udp4_target(const char *name)
Creates a network target for logging over IPv4 and UDP, but does not open it.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_new_tcp4_target(const char *name)
Creates a network target for logging over IPv4 and TCP, but does not open it.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_new_network_target(const char *name, enum stumpless_network_protocol network, enum stumpless_transport_protocol transport)
Creates a network target, but does not open it.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_set_udp_max_message_size(struct stumpless_target *target, size_t max_msg_size)
Sets the maximum message size of a UDP network target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_tcp6_target(const char *name, const char *destination)
Opens a network target for remote logging over IPv6 and TCP.
A target that log entries can be sent to.
Definition target.h:140
char * name
The name of this target.
Definition target.h:157
General types and functions for working with all targets.