summaryrefslogtreecommitdiff
path: root/lib/send.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/send.c')
-rw-r--r--lib/send.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/send.c b/lib/send.c
index e58b42c..1234fdd 100644
--- a/lib/send.c
+++ b/lib/send.c
@@ -11,7 +11,7 @@
#include <radsec/radsec.h>
#include <radsec/radsec-impl.h>
#include "debug.h"
-#include "packet.h"
+#include "message.h"
#include "event.h"
#include "peer.h"
#include "conn.h"
@@ -19,7 +19,7 @@
#include "udp.h"
static int
-_conn_open (struct rs_connection *conn, struct rs_packet *pkt)
+_conn_open (struct rs_connection *conn, struct rs_message *msg)
{
if (event_init_eventbase (conn))
return -1;
@@ -42,7 +42,7 @@ _conn_open (struct rs_connection *conn, struct rs_packet *pkt)
}
else
{
- if (udp_init (conn, pkt))
+ if (udp_init (conn, msg))
return -1;
if (udp_init_retransmit_timer (conn))
return -1;
@@ -65,29 +65,29 @@ _conn_is_open_p (struct rs_connection *conn)
static void
_wcb (void *user_data)
{
- struct rs_packet *pkt = (struct rs_packet *) user_data;
- assert (pkt);
- pkt->flags |= RS_PACKET_SENT;
- if (pkt->conn->bev)
- bufferevent_disable (pkt->conn->bev, EV_WRITE|EV_READ);
+ struct rs_message *msg = (struct rs_message *) user_data;
+ assert (msg);
+ msg->flags |= RS_MESSAGE_SENT;
+ if (msg->conn->bev)
+ bufferevent_disable (msg->conn->bev, EV_WRITE|EV_READ);
else
- event_del (pkt->conn->wev);
+ event_del (msg->conn->wev);
}
int
-rs_packet_send (struct rs_packet *pkt, void *user_data)
+rs_message_send (struct rs_message *msg, void *user_data)
{
struct rs_connection *conn = NULL;
int err = 0;
- assert (pkt);
- assert (pkt->conn);
- conn = pkt->conn;
+ assert (msg);
+ assert (msg->conn);
+ conn = msg->conn;
if (_conn_is_open_p (conn))
- packet_do_send (pkt);
+ message_do_send (msg);
else
- if (_conn_open (conn, pkt))
+ if (_conn_open (conn, msg))
return -1;
assert (conn->evb);
@@ -98,13 +98,13 @@ rs_packet_send (struct rs_packet *pkt, void *user_data)
if (conn->bev) /* TCP */
{
- bufferevent_setcb (conn->bev, NULL, tcp_write_cb, tcp_event_cb, pkt);
+ bufferevent_setcb (conn->bev, NULL, tcp_write_cb, tcp_event_cb, msg);
bufferevent_enable (conn->bev, EV_WRITE);
}
else /* UDP */
{
event_assign (conn->wev, conn->evb, event_get_fd (conn->wev),
- EV_WRITE, event_get_callback (conn->wev), pkt);
+ EV_WRITE, event_get_callback (conn->wev), msg);
err = event_add (conn->wev, NULL);
if (err < 0)
return rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
@@ -116,7 +116,7 @@ rs_packet_send (struct rs_packet *pkt, void *user_data)
if (!conn_user_dispatch_p (conn))
{
conn->callbacks.sent_cb = _wcb;
- conn->user_data = pkt;
+ conn->user_data = msg;
rs_debug (("%s: entering event loop\n", __func__));
err = event_base_dispatch (conn->evb);
if (err < 0)
@@ -127,7 +127,7 @@ rs_packet_send (struct rs_packet *pkt, void *user_data)
conn->callbacks.sent_cb = NULL;
conn->user_data = NULL;
- if ((pkt->flags & RS_PACKET_SENT) == 0)
+ if ((msg->flags & RS_MESSAGE_SENT) == 0)
{
assert (rs_err_conn_peek_code (conn));
return rs_err_conn_peek_code (conn);