The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
udpfromto.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/** API for sending and receiving packets on unconnected UDP sockets
19 *
20 * Like recvfrom, but also stores the destination IP address. Useful on multihomed hosts.
21 *
22 * @file src/lib/util/udpfromto.h
23 *
24 * @copyright 2015 The FreeRADIUS server project
25 */
26RCSIDH(udpfromto_h, "$Id: 04b1cd2e41275f5642ceed486b92b6021b1c8b5c $")
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <freeradius-devel/build.h>
33#include <freeradius-devel/missing.h>
34#include <freeradius-devel/util/time.h>
35
36#include <netinet/in.h>
37#include <stddef.h>
38#include <stdlib.h>
39
40int udpfromto_init(int s, int af);
41
42ssize_t recvfromto(int s, void *buf, size_t len, int flags,
43 int *ifindex,
44 struct sockaddr *from, socklen_t *fromlen,
45 struct sockaddr *to, socklen_t *tolen,
46 fr_time_t *when);
47
48ssize_t sendfromto(int s, void *buf, size_t len, int flags,
49 int ifindex,
50 struct sockaddr *from, socklen_t fromlen,
51 struct sockaddr *to, socklen_t tolen);
52#ifdef __cplusplus
53}
54#endif
#define RCSIDH(h, id)
Definition build.h:604
long int ssize_t
"server local" time.
Definition time.h:69
ssize_t recvfromto(int s, void *buf, size_t len, int flags, int *ifindex, struct sockaddr *from, socklen_t *fromlen, struct sockaddr *to, socklen_t *tolen, fr_time_t *when)
Read a packet from a file descriptor, retrieving additional header information.
Definition udpfromto.c:202
int udpfromto_init(int s, int af)
Definition udpfromto.c:95
ssize_t sendfromto(int s, void *buf, size_t len, int flags, int ifindex, struct sockaddr *from, socklen_t fromlen, struct sockaddr *to, socklen_t tolen)
Send packet via a file descriptor, setting the src address and outbound interface.
Definition udpfromto.c:421
static fr_sbuff_err_t char size_t * len
Definition value.h:1061