Annotation of embedaddon/strongswan/src/libradius/radius_socket.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2010 Martin Willi
3: * Copyright (C) 2010 revosec AG
4: *
5: * This program is free software; you can redistribute it and/or modify it
6: * under the terms of the GNU General Public License as published by the
7: * Free Software Foundation; either version 2 of the License, or (at your
8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /*
17: * Copyright (C) 2015 Thom Troy
18: *
19: * Permission is hereby granted, free of charge, to any person obtaining a copy
20: * of this software and associated documentation files (the "Software"), to deal
21: * in the Software without restriction, including without limitation the rights
22: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23: * copies of the Software, and to permit persons to whom the Software is
24: * furnished to do so, subject to the following conditions:
25: *
26: * The above copyright notice and this permission notice shall be included in
27: * all copies or substantial portions of the Software.
28: *
29: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35: * THE SOFTWARE.
36: */
37:
38: /**
39: * @defgroup radius_socket radius_socket
40: * @{ @ingroup libradius
41: */
42:
43: #ifndef RADIUS_SOCKET_H_
44: #define RADIUS_SOCKET_H_
45:
46: typedef struct radius_socket_t radius_socket_t;
47:
48: #include "radius_message.h"
49:
50: #include <networking/host.h>
51:
52: /**
53: * RADIUS socket to a server.
54: */
55: struct radius_socket_t {
56:
57: /**
58: * Send a RADIUS request, wait for response.
59: *
60: * The socket fills in RADIUS Message identifier, builds a
61: * Request-Authenticator and calculates the Message-Authenticator
62: * attribute.
63: * The received response gets verified using the Response-Identifier
64: * and the Message-Authenticator attribute.
65: *
66: * @param request request message
67: * @return response message, NULL if timed out
68: */
69: radius_message_t* (*request)(radius_socket_t *this,
70: radius_message_t *request);
71:
72: /**
73: * Decrypt the MSK encoded in a messages MS-MPPE-Send/Recv-Key.
74: *
75: * @param request associated RADIUS request message
76: * @param response RADIUS response message containing attributes
77: * @return allocated MSK, empty chunk if none found
78: */
79: chunk_t (*decrypt_msk)(radius_socket_t *this, radius_message_t *request,
80: radius_message_t *response);
81:
82: /**
83: * Destroy a radius_socket_t.
84: */
85: void (*destroy)(radius_socket_t *this);
86: };
87:
88: /**
89: * Create a radius_socket instance.
90: *
91: * @param address server name
92: * @param auth_port server port for authentication
93: * @param acct_port server port for accounting
94: * @param secret RADIUS secret
95: * @param tries number of times we retransmit messages
96: * @param timeout retransmission timeout
97: * @param base base to calculate retransmission timeout
98: */
99: radius_socket_t *radius_socket_create(char *address, uint16_t auth_port,
100: uint16_t acct_port, chunk_t secret,
101: u_int tries, double timeout, double base);
102:
103: #endif /** RADIUS_SOCKET_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>