rspro_server_conn: Add handle_rx() call-back

This call-back receives all already-decoded RSPRO PDUs from the server.

Change-Id: I5f410aa6071c9a987c2811f22fb2f3ff018b3cc1
This commit is contained in:
Harald Welte 2018-10-14 20:40:05 +02:00
parent 4248bec905
commit f9995a36fd
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,7 @@
#include <osmocom/core/fsm.h>
#include <osmocom/abis/ipa.h>
#include <osmocom/rspro/RsproPDU.h>
#include "rspro_util.h"
#include "debug.h"
@ -23,11 +24,14 @@ enum server_conn_fsm_event {
SRVC_E_CLIENT_CONN_RES,
};
struct rspro_server_conn;
/* representing a client-side connection to a RSPRO server */
struct rspro_server_conn {
/* state */
struct ipa_client_conn *conn;
struct osmo_fsm_inst *fi;
int (*handle_rx)(struct rspro_server_conn *conn, RsproPDU_t *pdu);
/* our own component ID */
struct app_comp_id own_comp_id;

View File

@ -269,6 +269,7 @@ static int srvc_read_cb(struct ipa_client_conn *conn, struct msgb *msg)
struct ipaccess_head *hh = (struct ipaccess_head *) msg->data;
struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg);
struct rspro_server_conn *srvc = conn->data;
RsproPDU_t *pdu;
int rc;
if (msgb_length(msg) < sizeof(*hh))
@ -284,12 +285,12 @@ static int srvc_read_cb(struct ipa_client_conn *conn, struct msgb *msg)
goto invalid;
printf("Received RSPRO %s\n", msgb_hexdump(msg));
#if 0
rc = bankd_handle_msg(srvc, msg);
msgb_free(msg);
pdu = rspro_dec_msg(msg);
if (!pdu)
goto invalid;
rc = srvc->handle_rx(srvc, pdu);
return rc;
#endif
invalid:
msgb_free(msg);