stumpless  2.1.0
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
66 extern "C" {
67 # endif
68 
75 };
76 
83 };
84 
109 void
111 
144 const char *
146 
177 const char *
179 
202 size_t
204 
239 struct stumpless_target *
241  enum stumpless_network_protocol network,
242  enum stumpless_transport_protocol transport );
243 
274 struct stumpless_target *
276 
307 struct stumpless_target *
309 
340 struct stumpless_target *
342 
373 struct stumpless_target *
375 
411 struct stumpless_target *
413  const char *destination,
414  enum stumpless_network_protocol network,
415  enum stumpless_transport_protocol transport );
416 
446 struct stumpless_target *
447 stumpless_open_tcp4_target( const char *name, const char *destination );
448 
478 struct stumpless_target *
479 stumpless_open_tcp6_target( const char *name, const char *destination );
480 
508 struct stumpless_target *
509 stumpless_open_udp4_target( const char *name, const char *destination );
510 
538 struct stumpless_target *
539 stumpless_open_udp6_target( const char *name, const char *destination );
540 
579 struct stumpless_target *
581  const char *destination );
582 
627 struct stumpless_target *
629  const char *port );
630 
668 struct stumpless_target *
670  size_t max_msg_size );
671 
697 stumpless_get_network_protocol( const struct stumpless_target *target );
698 
723 stumpless_get_transport_protocol( const struct stumpless_target *target );
724 
725 # ifdef __cplusplus
726 } /* extern "C" */
727 # endif
728 #endif /* __STUMPLESS_TARGET_NETWORK_H */
stumpless_new_tcp6_target
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_get_network_protocol
enum stumpless_network_protocol stumpless_get_network_protocol(const struct stumpless_target *target)
Gets the network protocol of a network target.
STUMPLESS_TCP_TRANSPORT_PROTOCOL
@ STUMPLESS_TCP_TRANSPORT_PROTOCOL
TCP, RFC 793.
Definition: network.h:81
stumpless_new_udp6_target
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_get_transport_protocol
enum stumpless_transport_protocol stumpless_get_transport_protocol(const struct stumpless_target *target)
Gets the transport protocol of a network target.
stumpless_get_udp_max_message_size
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_get_destination
const char * stumpless_get_destination(const struct stumpless_target *target)
Gets the destination of a network target.
stumpless_target::name
char * name
The name of this target.
Definition: target.h:153
stumpless_open_tcp4_target
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_open_udp4_target
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_target
A target that log entries can be sent to.
Definition: target.h:136
stumpless_new_network_target
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_get_transport_port
const char * stumpless_get_transport_port(const struct stumpless_target *target)
Gets the transport port number of a network target.
stumpless_open_network_target
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_set_transport_port
struct stumpless_target * stumpless_set_transport_port(struct stumpless_target *target, const char *port)
Sets the transport port number of a network target.
stumpless_open_udp6_target
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_new_tcp4_target
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.
target.h
stumpless_open_tcp6_target
struct stumpless_target * stumpless_open_tcp6_target(const char *name, const char *destination)
Opens a network target for remote logging over IPv6 and TCP.
STUMPLESS_IPV4_NETWORK_PROTOCOL
@ STUMPLESS_IPV4_NETWORK_PROTOCOL
Internet Protocol version 4, RFC 791.
Definition: network.h:73
STUMPLESS_PUBLIC_FUNCTION
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
Definition: config.h:31
STUMPLESS_IPV6_NETWORK_PROTOCOL
@ STUMPLESS_IPV6_NETWORK_PROTOCOL
Internet Protocl version 6, RFC 8200.
Definition: network.h:74
stumpless_set_udp_max_message_size
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.
config.h
stumpless_network_protocol
stumpless_network_protocol
Network protocols used by a network target.
Definition: network.h:72
stumpless_new_udp4_target
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_transport_protocol
stumpless_transport_protocol
Transport protocols used by a network target.
Definition: network.h:80
STUMPLESS_UDP_TRANSPORT_PROTOCOL
@ STUMPLESS_UDP_TRANSPORT_PROTOCOL
UDP, RFC 768.
Definition: network.h:82
stumpless_set_destination
struct stumpless_target * stumpless_set_destination(struct stumpless_target *target, const char *destination)
Sets the destination of a network target.
stumpless_close_network_target
void stumpless_close_network_target(const struct stumpless_target *target)
Closes a network target.