ef422b533ecf0de502d80ee40a078e338218dfbe
[radsecproxy.git] / lib / include / radsec / request.h
1 /** \file request.h
2     \brief Public interface for libradsec request's.  */
3
4 /* See the file COPYING for licensing information.  */
5
6 struct rs_request;
7
8 #if defined (__cplusplus)
9 extern "C" {
10 #endif
11
12 /** Create a request associated with connection \a conn.  */
13 int rs_request_create(struct rs_connection *conn, struct rs_request **req_out);
14 /** Add RADIUS request message \a req_msg to request \a req.  */
15 void rs_request_add_reqpkt(struct rs_request *req, struct rs_packet *req_msg);
16
17 /** Create a request associated with connection \a conn containing a
18     RADIUS authentication message with \a user_name and \a user_pw
19     attributes.  \a user_name and _user_pw are optional and can be
20     NULL.  */
21 int rs_request_create_authn(struct rs_connection *conn,
22                             struct rs_request **req_out,
23                             const char *user_name,
24                             const char *user_pw);
25 /** Send request \a req and wait for a matching response.  The
26     response is put in \a resp_msg (if not NULL).  NOTE: At present,
27     no more than one outstanding request to a given realm is
28     supported.  This will change in a future version.  */
29 int rs_request_send(struct rs_request *req, struct rs_packet **resp_msg);
30
31 /** Free all memory allocated by request \a req including the request
32     packet and any response package associated with the request.  Note
33     that a request must be freed before its associated connection can
34     be freed.  */
35 void rs_request_destroy(struct rs_request *req);
36
37 #if defined (__cplusplus)
38 }
39 #endif