summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-02 23:01:02 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-02 23:01:02 +0800
commit3e021b827fafd1d59cec384d92d406e9c2af97ea (patch)
treec939d0e274fdc72d003246c3a2b38c7b89cd77ef
parentb5a2f8d589bcca11e953a3ea8b28c708e7c5849b (diff)
sccp.c: Make the create work with data + len to not have a msgb
-rw-r--r--include/sccp/sccp.h2
-rw-r--r--src/sccp.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/include/sccp/sccp.h b/include/sccp/sccp.h
index d19a977..ed833e3 100644
--- a/include/sccp/sccp.h
+++ b/include/sccp/sccp.h
@@ -166,7 +166,7 @@ struct msgb *sccp_create_cc(struct sccp_source_reference *src_ref, struct sccp_s
struct msgb *sccp_create_rlsd(struct sccp_source_reference *src_ref, struct sccp_source_reference *dst_ref, int cause);
struct msgb *sccp_create_dt1(struct sccp_source_reference *dst_ref, uint8_t *data, uint8_t len);
struct msgb *sccp_create_udt(int _class, const struct sockaddr_sccp *sock_sender,
- const struct sockaddr_sccp *sock_target, struct msgb *msg);
+ const struct sockaddr_sccp *sock_target, uint8_t *data, int len);
/**
* Below this are helper functions and structs for parsing SCCP messages
diff --git a/src/sccp.c b/src/sccp.c
index 42cbd96..97e19bd 100644
--- a/src/sccp.c
+++ b/src/sccp.c
@@ -513,12 +513,12 @@ static void create_sccp_addr(struct msgb *msg, const struct sockaddr_sccp *sock)
* Send UDT. Currently we have a fixed address...
*/
struct msgb *sccp_create_udt(int class, const struct sockaddr_sccp *in,
- const struct sockaddr_sccp *out, struct msgb *payload)
+ const struct sockaddr_sccp *out, uint8_t *in_data, int len)
{
struct sccp_data_unitdata *udt;
uint8_t *data;
- if (msgb_l3len(payload) > 256) {
+ if (len > 256) {
LOGP(DSCCP, LOGL_ERROR, "The payload is too big for one udt\n");
return NULL;
}
@@ -542,9 +542,9 @@ struct msgb *sccp_create_udt(int class, const struct sockaddr_sccp *in,
create_sccp_addr(msg, in);
/* copy the payload */
- data = msgb_put(msg, 1 + msgb_l3len(payload));
- data[0] = msgb_l3len(payload);
- memcpy(&data[1], payload->l3h, msgb_l3len(payload));
+ data = msgb_put(msg, 1 + len);
+ data[0] = len;
+ memcpy(&data[1], in_data, len);
return msg;
}
@@ -554,7 +554,7 @@ static int _sccp_send_data(int class, const struct sockaddr_sccp *in,
{
struct msgb *msg;
- msg = sccp_create_udt(class, in, out, payload);
+ msg = sccp_create_udt(class, in, out, payload->l3h, msgb_l3len(payload));
if (!msg)
return -1;