aboutsummaryrefslogtreecommitdiffstats
path: root/src/diag_io.h
blob: d3fd64ea77ce8f87dd11b817b81b81cb2a31753c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <stdint.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/gsmtap_util.h>

#define DIAG_INST_F_HEXDUMP	0x00000001
#define DIAG_INST_F_GSMTAP_DIAG	0x00000002

struct diag_instance {
	int fd;
	struct {
		struct msgb *msg;
	} rx;
	struct {
	} tx;
	struct gsmtap_inst *gsmtap;
	uint32_t flags;
};

struct msgb *msgb_alloc_diag(void);
int diag_transmit_msgb(struct diag_instance *di, struct msgb *msg);
int diag_transmit_buf(struct diag_instance *di, const uint8_t *data, size_t data_len);
struct msgb *diag_read_msg(struct diag_instance *di);
int diag_process_msg(struct diag_instance *di, struct msgb *msg);
struct msgb *diag_transceive_msg(struct diag_instance *di, struct msgb *tx);
struct msgb *diag_subsys_transceive_msg(struct diag_instance *di, struct msgb *tx,
					uint8_t subsys, uint16_t code);
void diag_transceive_msg_ign(struct diag_instance *di, struct msgb *tx);
struct msgb *diag_transceive_buf(struct diag_instance *di, const uint8_t *data, size_t data_len);
void diag_transceive_buf_ign(struct diag_instance *di, const uint8_t *data, size_t data_len);