summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-10-14 22:48:47 +0200
committerPatrick McHardy <kaber@trash.net>2010-10-14 23:06:41 +0200
commitfb4c54d53c498061af446cae7864b07976f9c498 (patch)
tree00d56284be2d0899887d6a7ce5d6c8b01157656e /src
parenta433fa4d8f5f436a7e42547bc670f71e586f862d (diff)
ie: add support for <<EVENTS-NOTIFICATION>> IE
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src')
-rw-r--r--src/s_msg.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/s_msg.c b/src/s_msg.c
index e8561c1..267be9f 100644
--- a/src/s_msg.c
+++ b/src/s_msg.c
@@ -2024,6 +2024,44 @@ static int dect_sfmt_build_codec_list(struct dect_sfmt_ie *dst,
return 0;
}
+static const struct dect_trans_tbl dect_event_types[] = {
+ TRANS_TBL(DECT_EVENT_MESSAGE_WAITING, "Message waiting"),
+ TRANS_TBL(DECT_EVENT_MISSED_CALL, "Missed call"),
+ TRANS_TBL(DECT_EVENT_WEB_CONTENT, "Web content"),
+ TRANS_TBL(DECT_EVENT_LIST_CHANGE_INDICATION, "List change indication"),
+};
+
+static void dect_sfmt_dump_events_notification(const struct dect_ie_common *_ie)
+{
+ struct dect_ie_events_notification *ie = dect_ie_container(ie, _ie);
+ unsigned int i;
+ char buf[128];
+
+ for (i = 0; i < ie->num; i++) {
+ sfmt_debug("\tEvent %u:\n", i + 1);
+ sfmt_debug("\t Event type: %s\n",
+ dect_val2str(dect_event_types, buf, ie->events[i].type));
+ sfmt_debug("\t Event subtype: %u\n", ie->events[i].subtype);
+ sfmt_debug("\t Event multiplicity: %u\n", ie->events[i].multiplicity);
+ }
+}
+
+static int dect_sfmt_build_events_notification(struct dect_sfmt_ie *dst,
+ const struct dect_ie_common *ie)
+{
+ struct dect_ie_events_notification *src = dect_ie_container(src, ie);
+ unsigned int n = 2, i;
+
+ for (i = 0; i < src->num; i++) {
+ dst->data[n++] = src->events[i].type;
+ dst->data[n++] = src->events[i].subtype | DECT_OCTET_GROUP_END;
+ dst->data[n++] = src->events[i].multiplicity | DECT_OCTET_GROUP_END;
+ }
+
+ dst->len = n;
+ return 0;
+}
+
static const struct dect_ie_handler {
const char *name;
size_t size;
@@ -2394,6 +2432,8 @@ static const struct dect_ie_handler {
[DECT_IE_EVENTS_NOTIFICATION] = {
.name = "EVENTS-NOTIFICATION",
.size = sizeof(struct dect_ie_events_notification),
+ .build = dect_sfmt_build_events_notification,
+ .dump = dect_sfmt_dump_events_notification,
},
[DECT_IE_CALL_INFORMATION] = {
.name = "CALL-INFORMATION",