1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef APR_NETWORK_IO_H
18
#define APR_NETWORK_IO_H
20
* @file apr_network_io.h
21
* @brief APR Network library
25
#include "apr_pools.h"
26
#include "apr_file_io.h"
27
#include "apr_errno.h"
28
#include "apr_inherit.h"
30
#if APR_HAVE_NETINET_IN_H
31
#include <netinet/in.h>
36
#endif /* __cplusplus */
39
* @defgroup apr_network_io Network Routines
44
#ifndef APR_MAX_SECS_TO_LINGER
45
/** Maximum seconds to linger */
46
#define APR_MAX_SECS_TO_LINGER 30
50
/** Maximum hostname length */
51
#define APRMAXHOSTLEN 256
55
/** Default 'any' address */
56
#define APR_ANYADDR "0.0.0.0"
60
* @defgroup apr_sockopt Socket option definitions
63
#define APR_SO_LINGER 1 /**< Linger */
64
#define APR_SO_KEEPALIVE 2 /**< Keepalive */
65
#define APR_SO_DEBUG 4 /**< Debug */
66
#define APR_SO_NONBLOCK 8 /**< Non-blocking IO */
67
#define APR_SO_REUSEADDR 16 /**< Reuse addresses */
68
#define APR_SO_SNDBUF 64 /**< Send buffer */
69
#define APR_SO_RCVBUF 128 /**< Receive buffer */
70
#define APR_SO_DISCONNECTED 256 /**< Disconnected */
71
#define APR_TCP_NODELAY 512 /**< For SCTP sockets, this is mapped
72
* to STCP_NODELAY internally.
74
#define APR_TCP_NOPUSH 1024 /**< No push */
75
#define APR_RESET_NODELAY 2048 /**< This flag is ONLY set internally
76
* when we set APR_TCP_NOPUSH with
77
* APR_TCP_NODELAY set to tell us that
78
* APR_TCP_NODELAY should be turned on
79
* again when NOPUSH is turned off
81
#define APR_INCOMPLETE_READ 4096 /**< Set on non-blocking sockets
82
* (timeout != 0) on which the
83
* previous read() did not fill a buffer
84
* completely. the next apr_socket_recv()
85
* will first call select()/poll() rather than
86
* going straight into read(). (Can also
87
* be set by an application to force a
88
* select()/poll() call before the next
89
* read, in cases where the app expects
90
* that an immediate read would fail.)
92
#define APR_INCOMPLETE_WRITE 8192 /**< like APR_INCOMPLETE_READ, but for write
93
* @see APR_INCOMPLETE_READ
95
#define APR_IPV6_V6ONLY 16384 /**< Don't accept IPv4 connections on an
96
* IPv6 listening socket.
98
#define APR_TCP_DEFER_ACCEPT 32768 /**< Delay accepting of new connections
99
* until data is available.
100
* @see apr_socket_accept_filter
105
/** Define what type of socket shutdown should occur. */
107
APR_SHUTDOWN_READ, /**< no longer allow read request */
108
APR_SHUTDOWN_WRITE, /**< no longer allow write requests */
109
APR_SHUTDOWN_READWRITE /**< no longer allow read or write requests */
110
} apr_shutdown_how_e;
112
#define APR_IPV4_ADDR_OK 0x01 /**< @see apr_sockaddr_info_get() */
113
#define APR_IPV6_ADDR_OK 0x02 /**< @see apr_sockaddr_info_get() */
115
#if (!APR_HAVE_IN_ADDR)
117
* We need to make sure we always have an in_addr type, so APR will just
118
* define it ourselves, if the platform doesn't provide it.
121
apr_uint32_t s_addr; /**< storage to hold the IP# */
125
/** @def APR_INADDR_NONE
126
* Not all platforms have a real INADDR_NONE. This macro replaces
127
* INADDR_NONE on all platforms.
130
#define APR_INADDR_NONE INADDR_NONE
132
#define APR_INADDR_NONE ((unsigned int) 0xffffffff)
137
* Not all platforms have these defined, so we'll define them here
138
* The default values come from FreeBSD 4.1.1
140
#define APR_INET AF_INET
142
* Let the system decide which address family to use
145
#define APR_UNSPEC AF_UNSPEC
151
* IPv6 Address Family. Not all platforms may have this defined.
154
#define APR_INET6 AF_INET6
158
* @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
161
#define APR_PROTO_TCP 6 /**< TCP */
162
#define APR_PROTO_UDP 17 /**< UDP */
163
#define APR_PROTO_SCTP 132 /**< SCTP */
167
* Enum to tell us if we're interested in remote or local socket
175
* The specific declaration of inet_addr's ... some platforms fall back
176
* inet_network (this is not good, but necessary)
179
#if APR_HAVE_INET_ADDR
180
#define apr_inet_addr inet_addr
181
#elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
184
* not generally safe... inet_network() and inet_addr() perform
185
* different functions */
186
#define apr_inet_addr inet_network
189
/** A structure to represent sockets */
190
typedef struct apr_socket_t apr_socket_t;
192
* A structure to encapsulate headers and trailers for apr_socket_sendfile
194
typedef struct apr_hdtr_t apr_hdtr_t;
195
/** A structure to represent in_addr */
196
typedef struct in_addr apr_in_addr_t;
197
/** A structure to represent an IP subnet */
198
typedef struct apr_ipsubnet_t apr_ipsubnet_t;
200
/** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
201
typedef apr_uint16_t apr_port_t;
203
/** @remark It's defined here as I think it should all be platform safe...
204
* @see apr_sockaddr_t
206
typedef struct apr_sockaddr_t apr_sockaddr_t;
208
* APRs socket address type, used to ensure protocol independence
210
struct apr_sockaddr_t {
211
/** The pool to use... */
215
/** Either a string of the port number or the service name for the port */
217
/** The numeric port */
221
/** How big is the sockaddr we're using? */
223
/** How big is the ip address structure we're using? */
225
/** How big should the address buffer be? 16 for v4 or 46 for v6
226
* used in inet_ntop... */
228
/** This points to the IP address structure within the appropriate
229
* sockaddr structure. */
231
/** If multiple addresses were found by apr_sockaddr_info_get(), this
232
* points to a representation of the next address. */
233
apr_sockaddr_t *next;
234
/** Union of either IPv4 or IPv6 sockaddr. */
236
/** IPv4 sockaddr structure */
237
struct sockaddr_in sin;
239
/** IPv6 sockaddr structure */
240
struct sockaddr_in6 sin6;
242
#if APR_HAVE_SA_STORAGE
243
/** Placeholder to ensure that the size of this union is not
244
* dependent on whether APR_HAVE_IPV6 is defined. */
245
struct sockaddr_storage sas;
252
* Support reusing the socket on platforms which support it (from disconnect,
253
* specifically Win32.
254
* @remark Optional flag passed into apr_socket_sendfile()
256
#define APR_SENDFILE_DISCONNECT_SOCKET 1
259
/** A structure to encapsulate headers and trailers for apr_socket_sendfile */
261
/** An iovec to store the headers sent before the file. */
262
struct iovec* headers;
263
/** number of headers in the iovec */
265
/** An iovec to store the trailers sent after the file. */
266
struct iovec* trailers;
267
/** number of trailers in the iovec */
271
/* function definitions */
275
* @param new_sock The new socket that has been set up.
276
* @param family The address family of the socket (e.g., APR_INET).
277
* @param type The type of the socket (e.g., SOCK_STREAM).
278
* @param protocol The protocol of the socket (e.g., APR_PROTO_TCP).
279
* @param cont The pool to use
281
APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock,
282
int family, int type,
287
* Shutdown either reading, writing, or both sides of a socket.
288
* @param thesocket The socket to close
289
* @param how How to shutdown the socket. One of:
291
* APR_SHUTDOWN_READ no longer allow read requests
292
* APR_SHUTDOWN_WRITE no longer allow write requests
293
* APR_SHUTDOWN_READWRITE no longer allow read or write requests
295
* @see apr_shutdown_how_e
296
* @remark This does not actually close the socket descriptor, it just
297
* controls which calls are still valid on the socket.
299
APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket,
300
apr_shutdown_how_e how);
304
* @param thesocket The socket to close
306
APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket);
309
* Bind the socket to its associated port
310
* @param sock The socket to bind
311
* @param sa The socket address to bind to
312
* @remark This may be where we will find out if there is any other process
313
* using the selected port.
315
APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock,
319
* Listen to a bound socket for connections.
320
* @param sock The socket to listen on
321
* @param backlog The number of outstanding connections allowed in the sockets
322
* listen queue. If this value is less than zero, the listen
323
* queue size is set to zero.
325
APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock,
326
apr_int32_t backlog);
329
* Accept a new connection request
330
* @param new_sock A copy of the socket that is connected to the socket that
331
* made the connection request. This is the socket which should
332
* be used for all future communication.
333
* @param sock The socket we are listening on.
334
* @param connection_pool The pool for the new socket.
336
APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock,
338
apr_pool_t *connection_pool);
341
* Issue a connection request to a socket either on the same machine
342
* or a different one.
343
* @param sock The socket we wish to use for our side of the connection
344
* @param sa The address of the machine we wish to connect to.
346
APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock,
350
* Create apr_sockaddr_t from hostname, address family, and port.
351
* @param sa The new apr_sockaddr_t.
352
* @param hostname The hostname or numeric address string to resolve/parse, or
353
* NULL to build an address that corresponds to 0.0.0.0 or ::
354
* @param family The address family to use, or APR_UNSPEC if the system should
356
* @param port The port number.
357
* @param flags Special processing flags:
359
* APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
360
* for IPv6 addresses if the first query failed;
361
* only valid if family is APR_UNSPEC and hostname
362
* isn't NULL; mutually exclusive with
364
* APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
365
* for IPv4 addresses if the first query failed;
366
* only valid if family is APR_UNSPEC and hostname
367
* isn't NULL and APR_HAVE_IPV6; mutually exclusive
368
* with APR_IPV4_ADDR_OK
370
* @param p The pool for the apr_sockaddr_t and associated storage.
372
APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa,
373
const char *hostname,
380
* Look up the host name from an apr_sockaddr_t.
381
* @param hostname The hostname.
382
* @param sa The apr_sockaddr_t.
383
* @param flags Special processing flags.
385
APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname,
390
* Parse hostname/IP address with scope id and port.
392
* Any of the following strings are accepted:
393
* 8080 (just the port number)
394
* www.apache.org (just the hostname)
395
* www.apache.org:8080 (hostname and port number)
396
* [fe80::1]:80 (IPv6 numeric address string only)
397
* [fe80::1%eth0] (IPv6 numeric address string and scope id)
401
* [abc] (not valid IPv6 numeric address string)
402
* abc:65536 (invalid port number)
404
* @param addr The new buffer containing just the hostname. On output, *addr
405
* will be NULL if no hostname/IP address was specfied.
406
* @param scope_id The new buffer containing just the scope id. On output,
407
* *scope_id will be NULL if no scope id was specified.
408
* @param port The port number. On output, *port will be 0 if no port was
410
* ### FIXME: 0 is a legal port (per RFC 1700). this should
411
* ### return something besides zero if the port is missing.
412
* @param str The input string to be parsed.
413
* @param p The pool from which *addr and *scope_id are allocated.
414
* @remark If scope id shouldn't be allowed, check for scope_id != NULL in
415
* addition to checking the return code. If addr/hostname should be
416
* required, check for addr == NULL in addition to checking the
419
APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr,
426
* Get name of the current machine
427
* @param buf A buffer to store the hostname in.
428
* @param len The maximum length of the hostname that can be stored in the
429
* buffer provided. The suggested length is APRMAXHOSTLEN + 1.
430
* @param cont The pool to use.
431
* @remark If the buffer was not large enough, an error will be returned.
433
APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, apr_pool_t *cont);
436
* Return the data associated with the current socket
437
* @param data The user data associated with the socket.
438
* @param key The key to associate with the user data.
439
* @param sock The currently open socket.
441
APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key,
445
* Set the data associated with the current socket.
446
* @param sock The currently open socket.
447
* @param data The user data to associate with the socket.
448
* @param key The key to associate with the data.
449
* @param cleanup The cleanup to call when the socket is destroyed.
451
APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data,
453
apr_status_t (*cleanup)(void*));
456
* Send data over a network.
457
* @param sock The socket to send the data over.
458
* @param buf The buffer which contains the data to be sent.
459
* @param len On entry, the number of bytes to send; on exit, the number
463
* This functions acts like a blocking write by default. To change
464
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
467
* It is possible for both bytes to be sent and an error to be returned.
469
* APR_EINTR is never returned.
472
APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf,
476
* Send multiple packets of data over a network.
477
* @param sock The socket to send the data over.
478
* @param vec The array of iovec structs containing the data to send
479
* @param nvec The number of iovec structs in the array
480
* @param len Receives the number of bytes actually written
483
* This functions acts like a blocking write by default. To change
484
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
486
* The number of bytes actually sent is stored in argument 3.
488
* It is possible for both bytes to be sent and an error to be returned.
490
* APR_EINTR is never returned.
493
APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock,
494
const struct iovec *vec,
495
apr_int32_t nvec, apr_size_t *len);
498
* @param sock The socket to send from
499
* @param where The apr_sockaddr_t describing where to send the data
500
* @param flags The flags to use
501
* @param buf The data to send
502
* @param len The length of the data to send
504
APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock,
505
apr_sockaddr_t *where,
506
apr_int32_t flags, const char *buf,
510
* @param from The apr_sockaddr_t to fill in the recipient info
511
* @param sock The socket to use
512
* @param flags The flags to use
513
* @param buf The buffer to use
514
* @param len The length of the available buffer
517
APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from,
519
apr_int32_t flags, char *buf,
522
#if APR_HAS_SENDFILE || defined(DOXYGEN)
525
* Send a file from an open file descriptor to a socket, along with
526
* optional headers and trailers
527
* @param sock The socket to which we're writing
528
* @param file The open file from which to read
529
* @param hdtr A structure containing the headers and trailers to send
530
* @param offset Offset into the file where we should begin writing
531
* @param len (input) - Number of bytes to send from the file
532
* (output) - Number of bytes actually sent,
533
* including headers, file, and trailers
534
* @param flags APR flags that are mapped to OS specific flags
535
* @remark This functions acts like a blocking write by default. To change
536
* this behavior, use apr_socket_timeout_set() or the
537
* APR_SO_NONBLOCK socket option.
538
* The number of bytes actually sent is stored in the len parameter.
539
* The offset parameter is passed by reference for no reason; its
540
* value will never be modified by the apr_socket_sendfile() function.
542
APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock,
549
#endif /* APR_HAS_SENDFILE */
552
* Read data from a network.
553
* @param sock The socket to read the data from.
554
* @param buf The buffer to store the data in.
555
* @param len On entry, the number of bytes to receive; on exit, the number
559
* This functions acts like a blocking read by default. To change
560
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
562
* The number of bytes actually received is stored in argument 3.
564
* It is possible for both bytes to be received and an APR_EOF or
565
* other error to be returned.
567
* APR_EINTR is never returned.
570
APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock,
571
char *buf, apr_size_t *len);
574
* Setup socket options for the specified socket
575
* @param sock The socket to set up.
576
* @param opt The option we would like to configure. One of:
578
* APR_SO_DEBUG -- turn on debugging information
579
* APR_SO_KEEPALIVE -- keep connections active
580
* APR_SO_LINGER -- lingers on close if data is present
581
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
582
* When this option is enabled, use
583
* the APR_STATUS_IS_EAGAIN() macro to
584
* see if a send or receive function
585
* could not transfer data without
587
* APR_SO_REUSEADDR -- The rules used in validating addresses
588
* supplied to bind should allow reuse
589
* of local addresses.
590
* APR_SO_SNDBUF -- Set the SendBufferSize
591
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
593
* @param on Value for the option.
595
APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock,
596
apr_int32_t opt, apr_int32_t on);
599
* Setup socket timeout for the specified socket
600
* @param sock The socket to set up.
601
* @param t Value for the timeout.
603
* t > 0 -- read and write calls return APR_TIMEUP if specified time
604
* elapsess with no data read or written
605
* t == 0 -- read and write calls never block
606
* t < 0 -- read and write calls block
609
APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock,
610
apr_interval_time_t t);
613
* Query socket options for the specified socket
614
* @param sock The socket to query
615
* @param opt The option we would like to query. One of:
617
* APR_SO_DEBUG -- turn on debugging information
618
* APR_SO_KEEPALIVE -- keep connections active
619
* APR_SO_LINGER -- lingers on close if data is present
620
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
621
* APR_SO_REUSEADDR -- The rules used in validating addresses
622
* supplied to bind should allow reuse
623
* of local addresses.
624
* APR_SO_SNDBUF -- Set the SendBufferSize
625
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
626
* APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
627
* (Currently only used on Windows)
629
* @param on Socket option returned on the call.
631
APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock,
632
apr_int32_t opt, apr_int32_t *on);
635
* Query socket timeout for the specified socket
636
* @param sock The socket to query
637
* @param t Socket timeout returned from the query.
639
APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock,
640
apr_interval_time_t *t);
643
* Query the specified socket if at the OOB/Urgent data mark
644
* @param sock The socket to query
645
* @param atmark Is set to true if socket is at the OOB/urgent mark,
646
* otherwise is set to false.
648
APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock,
652
* Return an apr_sockaddr_t from an apr_socket_t
653
* @param sa The returned apr_sockaddr_t.
654
* @param which Which interface do we want the apr_sockaddr_t for?
655
* @param sock The socket to use
657
APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa,
658
apr_interface_e which,
662
* Return the IP address (in numeric address string format) in
663
* an APR socket address. APR will allocate storage for the IP address
664
* string from the pool of the apr_sockaddr_t.
665
* @param addr The IP address.
666
* @param sockaddr The socket address to reference.
668
APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr,
669
apr_sockaddr_t *sockaddr);
672
* See if the IP addresses in two APR socket addresses are
673
* equivalent. Appropriate logic is present for comparing
674
* IPv4-mapped IPv6 addresses with IPv4 addresses.
676
* @param addr1 One of the APR socket addresses.
677
* @param addr2 The other APR socket address.
678
* @remark The return value will be non-zero if the addresses
681
APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
682
const apr_sockaddr_t *addr2);
685
* Return the type of the socket.
686
* @param sock The socket to query.
687
* @param type The returned type (e.g., SOCK_STREAM).
689
APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock,
693
* Given an apr_sockaddr_t and a service name, set the port for the service
694
* @param sockaddr The apr_sockaddr_t that will have its port set
695
* @param servname The name of the service you wish to use
697
APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr,
698
const char *servname);
700
* Build an ip-subnet representation from an IP address and optional netmask or
702
* @param ipsub The new ip-subnet representation
703
* @param ipstr The input IP address string
704
* @param mask_or_numbits The input netmask or number-of-bits string, or NULL
705
* @param p The pool to allocate from
707
APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub,
709
const char *mask_or_numbits,
713
* Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet
715
* @param ipsub The ip-subnet representation
716
* @param sa The socket address to test
717
* @return non-zero if the socket address is within the subnet, 0 otherwise
719
APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa);
721
#if APR_HAS_SO_ACCEPTFILTER || defined(DOXYGEN)
723
* Set an OS level accept filter.
724
* @param sock The socket to put the accept filter on.
725
* @param name The accept filter
726
* @param args Any extra args to the accept filter. Passing NULL here removes
729
apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name,
734
* Return the protocol of the socket.
735
* @param sock The socket to query.
736
* @param protocol The returned protocol (e.g., APR_PROTO_TCP).
738
APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock,
742
* Get the pool used by the socket.
744
APR_POOL_DECLARE_ACCESSOR(socket);
747
* Set a socket to be inherited by child processes.
749
APR_DECLARE_INHERIT_SET(socket);
752
* Unset a socket from being inherited by child processes.
754
APR_DECLARE_INHERIT_UNSET(socket);
757
* @defgroup apr_mcast IP Multicast
762
* Join a Multicast Group
763
* @param sock The socket to join a multicast group
764
* @param join The address of the multicast group to join
765
* @param iface Address of the interface to use. If NULL is passed, the
766
* default multicast interface will be used. (OS Dependent)
767
* @param source Source Address to accept transmissions from (non-NULL
768
* implies Source-Specific Multicast)
770
APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock,
771
apr_sockaddr_t *join,
772
apr_sockaddr_t *iface,
773
apr_sockaddr_t *source);
776
* Leave a Multicast Group. All arguments must be the same as
778
* @param sock The socket to leave a multicast group
779
* @param addr The address of the multicast group to leave
780
* @param iface Address of the interface to use. If NULL is passed, the
781
* default multicast interface will be used. (OS Dependent)
782
* @param source Source Address to accept transmissions from (non-NULL
783
* implies Source-Specific Multicast)
785
APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock,
786
apr_sockaddr_t *addr,
787
apr_sockaddr_t *iface,
788
apr_sockaddr_t *source);
791
* Set the Multicast Time to Live (ttl) for a multicast transmission.
792
* @param sock The socket to set the multicast ttl
793
* @param ttl Time to live to Assign. 0-255, default=1
794
* @remark If the TTL is 0, packets will only be seen by sockets on
795
* the local machine, and only when multicast loopback is enabled.
797
APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock,
801
* Toggle IP Multicast Loopback
802
* @param sock The socket to set multicast loopback
803
* @param opt 0=disable, 1=enable
805
APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock,
810
* Set the Interface to be used for outgoing Multicast Transmissions.
811
* @param sock The socket to set the multicast interface on
812
* @param iface Address of the interface to use for Multicast
814
APR_DECLARE(apr_status_t) apr_mcast_interface(apr_socket_t *sock,
815
apr_sockaddr_t *iface);
825
#endif /* ! APR_NETWORK_IO_H */