f12437316dcabcda1a5e906f5d3a14978876e21a
[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 #ifndef _RADSEC_REQUEST_H_
7 #define _RADSEC_REQUEST_H_ 1
8
9 struct rs_request;
10
11 #if defined (__cplusplus)
12 extern "C" {
13 #endif
14
15 /** Create a request associated with connection \a conn.  */
16 int rs_request_create(struct rs_connection *conn, struct rs_request **req_out);
17
18 /** Add RADIUS request message \a req_msg to request \a req.
19     FIXME: Rename to rs_request_add_reqmsg?  */
20 void rs_request_add_reqpkt(struct rs_request *req, struct rs_packet *req_msg);
21
22 /** Create a request associated with connection \a conn containing a
23     newly created RADIUS authentication message, possibly with \a
24     user_name and \a user_pw attributes.  \a user_name and _user_pw
25     are optional and can be NULL.  */
26 int rs_request_create_authn(struct rs_connection *conn,
27                             struct rs_request **req_out,
28                             const char *user_name,
29                             const char *user_pw);
30
31 /** Send request \a req and wait for a matching response.  The
32     response is put in \a resp_msg (if not NULL).  NOTE: At present,
33     no more than one outstanding request to a given realm is
34     supported.  This will change in a future version.  */
35 int rs_request_send(struct rs_request *req, struct rs_packet **resp_msg);
36
37 /** Free all memory allocated by request \a req including any request
38     packet associated with the request.  Note that a request must be
39     freed before its associated connection can be freed.  */
40 void rs_request_destroy(struct rs_request *req);
41
42 /** Return request message in request \a req.  */
43 struct rs_packet *rs_request_get_reqmsg(const struct rs_request *req);
44
45 #if defined (__cplusplus)
46 }
47 #endif
48
49 #endif /* _RADSEC_REQUEST_H_ */