summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/include/radsec/request.h21
-rw-r--r--lib/request.c13
2 files changed, 24 insertions, 10 deletions
diff --git a/lib/include/radsec/request.h b/lib/include/radsec/request.h
index ef422b5..e914164 100644
--- a/lib/include/radsec/request.h
+++ b/lib/include/radsec/request.h
@@ -11,29 +11,34 @@ extern "C" {
/** Create a request associated with connection \a conn. */
int rs_request_create(struct rs_connection *conn, struct rs_request **req_out);
-/** Add RADIUS request message \a req_msg to request \a req. */
+
+/** Add RADIUS request message \a req_msg to request \a req.
+ FIXME: Rename to rs_request_add_reqmsg? */
void rs_request_add_reqpkt(struct rs_request *req, struct rs_packet *req_msg);
/** Create a request associated with connection \a conn containing a
- RADIUS authentication message with \a user_name and \a user_pw
- attributes. \a user_name and _user_pw are optional and can be
- NULL. */
+ newly created RADIUS authentication message, possibly with \a
+ user_name and \a user_pw attributes. \a user_name and _user_pw
+ are optional and can be NULL. */
int rs_request_create_authn(struct rs_connection *conn,
struct rs_request **req_out,
const char *user_name,
const char *user_pw);
+
/** Send request \a req and wait for a matching response. The
response is put in \a resp_msg (if not NULL). NOTE: At present,
no more than one outstanding request to a given realm is
supported. This will change in a future version. */
int rs_request_send(struct rs_request *req, struct rs_packet **resp_msg);
-/** Free all memory allocated by request \a req including the request
- packet and any response package associated with the request. Note
- that a request must be freed before its associated connection can
- be freed. */
+/** Free all memory allocated by request \a req including any request
+ packet associated with the request. Note that a request must be
+ freed before its associated connection can be freed. */
void rs_request_destroy(struct rs_request *req);
+/** Return request message in request \a req. */
+struct rs_packet *rs_request_get_reqmsg(const struct rs_request *req);
+
#if defined (__cplusplus)
}
#endif
diff --git a/lib/request.c b/lib/request.c
index c74ed92..8d6a45e 100644
--- a/lib/request.c
+++ b/lib/request.c
@@ -53,15 +53,17 @@ rs_request_create_authn (struct rs_connection *conn,
const char *user_name,
const char *user_pw)
{
- struct rs_request *req;
+ struct rs_request *req = NULL;
assert (req_out);
+
if (rs_request_create (conn, &req))
return -1;
if (rs_packet_create_authn_request (conn, &req->req_msg, user_name, user_pw))
return -1;
- *req_out = req;
+ if (req_out)
+ *req_out = req;
return RSE_OK;
}
@@ -142,3 +144,10 @@ rs_request_send (struct rs_request *request, struct rs_packet **resp_msg)
rs_debug (("%s: returning %d\n", __func__, r));
return r;
}
+
+struct rs_packet *
+rs_request_get_reqmsg (const struct rs_request *request)
+{
+ assert (request);
+ return request->req_msg;
+}