Change in osmo-e1-recorder[master]: e1_recorder: Skip storing data to disk if line is in ALARM state

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Jan 12 13:19:07 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16185 )

Change subject: e1_recorder: Skip storing data to disk if line is in ALARM state
......................................................................

e1_recorder: Skip storing data to disk if line is in ALARM state

Change-Id: Ie4c671053d372bc700f506198d1916853da03b9e
---
M src/e1_recorder.c
M src/recorder.h
2 files changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/src/e1_recorder.c b/src/e1_recorder.c
index 82558b2..333375d 100644
--- a/src/e1_recorder.c
+++ b/src/e1_recorder.c
@@ -31,6 +31,29 @@
 	}
 }
 
+static int sig_inp_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data)
+{
+	struct input_signal_data *isd = signal_data;
+	struct e1_recorder_line *rline;
+
+	OSMO_ASSERT(subsys == SS_L_INPUT);
+	OSMO_ASSERT(isd->line && isd->line->num < ARRAY_SIZE(g_recorder.line));
+
+	switch (signal) {
+	case S_L_INP_LINE_ALARM:
+		LOGP(DMAIN, LOGL_NOTICE, "Line %u: ALARM\n", isd->line->num);
+		rline = &g_recorder.line[isd->line->num];
+		rline->has_alarm = true;
+		break;
+	case S_L_INP_LINE_NOALARM:
+		LOGP(DMAIN, LOGL_NOTICE, "Line %u: NOALARM\n", isd->line->num);
+		rline = &g_recorder.line[isd->line->num];
+		rline->has_alarm = false;
+		break;
+	}
+	return 0;
+}
+
 /* receive a raw message frome the E1 timeslot */
 void e1ts_raw_recv(struct e1inp_ts *ts, struct msgb *msg)
 {
@@ -38,6 +61,11 @@
 	enum osmo_e1cap_capture_mode cap_mode = ts2cap_mode(ts);
 	int rc;
 
+	if (rline->has_alarm) {
+		DEBUGP(DMAIN, "Skipping storage as line %u is in ALARM\n", ts->line->num);
+		return;
+	}
+
 	/* FIXME: special processing of TFP and PGSL */
 
 	rc = e1frame_store(ts, msg, cap_mode);
@@ -170,6 +198,8 @@
 
 	handle_options(argc, argv);
 
+	osmo_signal_register_handler(SS_L_INPUT, sig_inp_cbfn, NULL);
+
 	rc = vty_read_config_file(g_config_file, NULL);
 	if (rc < 0) {
 		fprintf(stderr, "Cannot parse configuration file '%s': %s\n", g_config_file,
diff --git a/src/recorder.h b/src/recorder.h
index 12bc993..458fb1d 100644
--- a/src/recorder.h
+++ b/src/recorder.h
@@ -17,6 +17,7 @@
 };
 
 struct e1_recorder_line {
+	bool has_alarm;
 	struct {
 		bool enabled;
 		uint8_t line_nr;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16185
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1-recorder
Gerrit-Branch: master
Gerrit-Change-Id: Ie4c671053d372bc700f506198d1916853da03b9e
Gerrit-Change-Number: 16185
Gerrit-PatchSet: 8
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200112/91332534/attachment.htm>


More information about the gerrit-log mailing list