Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <stdint.h> |
| 3 | |
| 4 | enum osmo_e1cap_capture_mode { |
| 5 | OSMO_E1CAP_MODE_RAW, |
| 6 | OSMO_E1CAP_MODE_HDLC, |
| 7 | OSMO_E1CAP_MODE_TRAU, |
| 8 | OSMO_E1CAP_MODE_PGSL, |
| 9 | }; |
| 10 | |
| 11 | /* header for each frame we store */ |
| 12 | struct osmo_e1cap_pkthdr { |
Harald Welte | afb6d39 | 2016-10-17 18:50:19 +0200 | [diff] [blame] | 13 | /* Timestamp at which frame was received */ |
Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 14 | struct timeval ts; |
Harald Welte | afb6d39 | 2016-10-17 18:50:19 +0200 | [diff] [blame] | 15 | /* length of frame data after this header */ |
Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 16 | uint32_t len; |
Harald Welte | afb6d39 | 2016-10-17 18:50:19 +0200 | [diff] [blame] | 17 | /* line/span number on which frame was received */ |
Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 18 | uint8_t line_nr; |
Harald Welte | afb6d39 | 2016-10-17 18:50:19 +0200 | [diff] [blame] | 19 | /* timeslot number on which frame was received */ |
Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 20 | uint8_t ts_nr; |
Harald Welte | afb6d39 | 2016-10-17 18:50:19 +0200 | [diff] [blame] | 21 | /* see osmo_e1cap_capture_mode */ |
Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 22 | uint8_t capture_mode; |
Harald Welte | afb6d39 | 2016-10-17 18:50:19 +0200 | [diff] [blame] | 23 | /* any optional future flags */ |
Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 24 | uint8_t flags; |
Harald Welte | 232b972 | 2016-10-18 23:50:49 +0200 | [diff] [blame] | 25 | uint8_t align[8]; |
| 26 | uint8_t data[0]; |
| 27 | } __attribute__((packed)); |
| 28 | |
| 29 | struct msgb; |
| 30 | struct e1inp_ts; |
Harald Welte | 39cfbf4 | 2016-07-28 09:04:11 +0200 | [diff] [blame] | 31 | |
| 32 | int e1frame_store(struct e1inp_ts *ts, struct msgb *msg, enum osmo_e1cap_capture_mode mode); |
Harald Welte | df7a306 | 2016-10-19 10:47:17 +0200 | [diff] [blame] | 33 | void storage_close(void); |
Harald Welte | dbb0f5a | 2016-10-18 23:51:54 +0200 | [diff] [blame] | 34 | |
| 35 | struct osmo_e1cap_file; |
| 36 | struct osmo_e1cap_file *osmo_e1cap_open(void *ctx, const char *path); |
| 37 | struct osmo_e1cap_pkthdr *osmo_e1cap_read_next(struct osmo_e1cap_file *f); |