update T tracer
not finished, UE may not work, many things bad/to fix properly
This commit is contained in:
@@ -16,31 +16,31 @@ ID = ENB_PHY_DL_TICK
|
||||
ID = ENB_PHY_DLSCH_UE_DCI
|
||||
DESC = eNodeB downlink UE specific DCI as sent by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS
|
||||
ID = ENB_PHY_DLSCH_UE_ACK
|
||||
DESC = eNodeB downlink UE ACK as seen by the PHY layer in process_HARQ_feedback
|
||||
GROUP = ALL:PHY:GRAPHIC:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = ENB_PHY_DLSCH_UE_NACK
|
||||
DESC = eNodeB downlink UE NACK as seen by the PHY layer in process_HARQ_feedback
|
||||
GROUP = ALL:PHY:GRAPHIC:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = ENB_PHY_ULSCH_UE_DCI
|
||||
DESC = eNodeB uplink UE specific DCI as sent by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid : int,mcs : int,round : int,first_rb : int,nb_rb : int,TBS : int,L : int,firstCCE
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid : int,mcs : int,round : int,first_rb : int,nb_rb : int,TBS : int,L : int,firstCCE
|
||||
ID = ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION
|
||||
DESC = eNodeB uplink UE retransmission due to PHICH NACK (see generate_phich_top)
|
||||
GROUP = ALL:PHY:GRAPHIC:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = ENB_PHY_ULSCH_UE_ACK
|
||||
DESC = eNodeB uplink UE ACK as seen by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = ENB_PHY_ULSCH_UE_NACK
|
||||
DESC = eNodeB uplink UE NACK as seen by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = ENB_PHY_INPUT_SIGNAL
|
||||
DESC = eNodeB received signal in the time domain for a duration of 1ms
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
|
||||
@@ -52,31 +52,31 @@ ID = ENB_PHY_OUTPUT_SIGNAL
|
||||
ID = ENB_PHY_UL_CHANNEL_ESTIMATE
|
||||
DESC = eNodeB channel estimation in the time domain
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,antenna : buffer,chest_t
|
||||
FORMAT = int,eNB_ID : int,rnti : int,frame : int,subframe : int,antenna : buffer,chest_t
|
||||
ID = ENB_PHY_PUSCH_IQ
|
||||
DESC = eNodeB PUSCH received IQ data
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,nb_rb : int,N_RB_UL : int,symbols_per_tti : buffer,pusch_comp
|
||||
FORMAT = int,eNB_ID : int,rnti : int,frame : int,subframe : int,nb_rb : int,N_RB_UL : int,symbols_per_tti : buffer,pusch_comp
|
||||
ID = ENB_PHY_PUCCH_1AB_IQ
|
||||
DESC = eNodeB PUCCH received IQ data
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,I : int,Q
|
||||
FORMAT = int,eNB_ID : int,rnti : int,frame : int,subframe : int,I : int,Q
|
||||
ID = ENB_PHY_PUCCH_1_ENERGY
|
||||
DESC = eNodeB PUCCH 1 energy and threshold
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,energy : int,threshold
|
||||
FORMAT = int,eNB_ID : int,rnti : int,frame : int,subframe : int,energy : int,threshold
|
||||
ID = ENB_PHY_PHICH
|
||||
DESC = eNodeB PHICH
|
||||
GROUP = ALL:PHY:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid : int,NGROUP : int,NSF : int,ngroup : int,nseq : int,ACK : int,first_rb : int,n_DMRS
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid : int,NGROUP : int,NSF : int,ngroup : int,nseq : int,ACK : int,first_rb : int,n_DMRS
|
||||
ID = ENB_PHY_MSG3_ALLOCATION
|
||||
DESC = eNodeB Msg3 allocation/reallocation
|
||||
GROUP = ALL:PHY:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe
|
||||
ID = ENB_PHY_INITIATE_RA_PROCEDURE
|
||||
DESC = eNodeB initiates a random access procedure after detecting enough energy for one of the preambles
|
||||
GROUP = ALL:PHY:ENB
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,preamble : int,energy : int,delay
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,preamble : int,energy : int,delay
|
||||
|
||||
#MAC logs
|
||||
ID = ENB_MAC_UE_DL_SDU
|
||||
@@ -834,27 +834,27 @@ ID = UE_PHY_DL_TICK
|
||||
ID = UE_PHY_DLSCH_UE_DCI
|
||||
DESC = UE downlink UE specific DCI as sent by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:UE
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS
|
||||
ID = UE_PHY_DLSCH_UE_ACK
|
||||
DESC = UE downlink UE ACK as seen by the PHY layer in process_HARQ_feedback
|
||||
GROUP = ALL:PHY:GRAPHIC:UE
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = UE_PHY_DLSCH_UE_NACK
|
||||
DESC = UE downlink UE NACK as seen by the PHY layer in process_HARQ_feedback
|
||||
GROUP = ALL:PHY:GRAPHIC:UE
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = UE_PHY_ULSCH_UE_DCI
|
||||
DESC = UE uplink UE specific DCI as sent by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:UE
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid : int,mcs : int,round : int,first_rb : int,nb_rb : int,TBS
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid : int,mcs : int,round : int,first_rb : int,nb_rb : int,TBS
|
||||
ID = UE_PHY_ULSCH_UE_ACK
|
||||
DESC = UE uplink UE ACK as seen by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:UE
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = UE_PHY_ULSCH_UE_NACK
|
||||
DESC = UE uplink UE NACK as seen by the PHY layer
|
||||
GROUP = ALL:PHY:GRAPHIC:UE
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,harq_pid
|
||||
ID = UE_PHY_INPUT_SIGNAL
|
||||
DESC = UE received signal in the time domain for a duration of 1ms
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
@@ -862,7 +862,7 @@ ID = UE_PHY_INPUT_SIGNAL
|
||||
ID = UE_PHY_DL_CHANNEL_ESTIMATE
|
||||
DESC = UE channel estimation in the time domain
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,antenna : buffer,chest_t
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,antenna : buffer,chest_t
|
||||
ID = UE_PHY_PDCCH_IQ
|
||||
DESC = UE PDCCH received IQ data
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
@@ -870,27 +870,27 @@ ID = UE_PHY_PDCCH_IQ
|
||||
ID = UE_PHY_PDCCH_ENERGY
|
||||
DESC = UE PDSCH 1 energy and threshold
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,pdcch_ch_level00 : int,pdcch_ch_level01 : int,pdcch_ch_level10: int,pdcch_ch_level11
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,pdcch_ch_level00 : int,pdcch_ch_level01 : int,pdcch_ch_level10: int,pdcch_ch_level11
|
||||
ID = UE_PHY_PDSCH_IQ
|
||||
DESC = UE PDSCH received IQ data
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,nb_rb : int,N_RB_UL : int,symbols_per_tti : buffer,pusch_comp
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,nb_rb : int,N_RB_UL : int,symbols_per_tti : buffer,pusch_comp
|
||||
ID = UE_PHY_PDSCH_ENERGY
|
||||
DESC = UE PDSCH 1 energy and threshold
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,pdsch_ch_level00 : int,pdsch_ch_level01 : int,pdsch_ch_level10: int,pdsch_ch_level11
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,pdsch_ch_level00 : int,pdsch_ch_level01 : int,pdsch_ch_level10: int,pdsch_ch_level11
|
||||
ID = UE_PHY_PUSCH_TX_POWER
|
||||
DESC = UE PUSCH tx power
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
FORMAT = int,eNB_ID : int,UE_id : int,frame : int,subframe : int,p0_pusch : int,ampl: int,g_pusch: int,pl: int,nb_rb
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,p0_pusch : int,ampl: int,g_pusch: int,pl: int,nb_rb
|
||||
ID = UE_PHY_PUCCH_TX_POWER
|
||||
DESC = UE PDSCH 1 energy and threshold
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
FORMAT = int,eNB_ID : int,UE_id : int,frame : int,subframe : int,p0_pucch : int,ampl: int,g_pucch: int,pl
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,p0_pucch : int,ampl: int,g_pucch: int,pl
|
||||
ID = UE_PHY_MEAS
|
||||
DESC = UE PHY measurements
|
||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:UE
|
||||
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,rsrp : int,rssi : int,snr: int,rx_power: int,noise_power: int,w_cqi: int,freq_offset
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rsrp : int,rssi : int,snr: int,rx_power: int,noise_power: int,w_cqi: int,freq_offset
|
||||
|
||||
#for debug/test - not used
|
||||
ID = first
|
||||
|
||||
@@ -17,6 +17,40 @@
|
||||
#include "openair_logo.h"
|
||||
#include "config.h"
|
||||
|
||||
/****************************************************************************/
|
||||
/* conversion from rnti to "ue_id" (which does not really exists) */
|
||||
/* the idea is to assign an ue_id to an rnti as soon as we get an event */
|
||||
/* for the rnti */
|
||||
/****************************************************************************/
|
||||
|
||||
int ue_id[65536];
|
||||
int next_ue_id;
|
||||
|
||||
void reset_ue_ids(void)
|
||||
{
|
||||
int i;
|
||||
printf("resetting known UEs\n");
|
||||
for (i = 0; i < 65536; i++) ue_id[i] = -1;
|
||||
next_ue_id = 0;
|
||||
}
|
||||
|
||||
int ue_id_from_rnti(void *_priv, int rnti)
|
||||
{
|
||||
rnti = 0; /* HACK, to be removed */
|
||||
if (rnti < 0 || rnti > 65535) { printf("bad rnti %d\n", rnti); exit(1); }
|
||||
/* rnti not seen yet? give it a new ue_id */
|
||||
if (ue_id[rnti] == -1) {
|
||||
ue_id[rnti] = next_ue_id;
|
||||
next_ue_id++;
|
||||
}
|
||||
return ue_id[rnti];
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* end of rnti->ue_id conversion */
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
typedef struct {
|
||||
view *phyview;
|
||||
view *macview;
|
||||
@@ -25,6 +59,7 @@ typedef struct {
|
||||
view *rrcview;
|
||||
view *legacy;
|
||||
widget *current_ue_label;
|
||||
widget *current_ue_button;
|
||||
widget *prev_ue_button;
|
||||
widget *next_ue_button;
|
||||
widget *pusch_iq_ue_xy_plot;
|
||||
@@ -116,11 +151,15 @@ static void *gui_thread(void *_g)
|
||||
static filter *ticktime_filter(void *database, char *event, int i, int ue)
|
||||
{
|
||||
/* filter is "harq_pid == i && UE_id == 0 && eNB_id == 0" */
|
||||
/* we get the UE_id from the rnti */
|
||||
return
|
||||
filter_and(
|
||||
filter_eq(filter_evarg(database, event, "harq_pid"), filter_int(i)),
|
||||
filter_and(
|
||||
filter_eq(filter_evarg(database, event, "UE_id"), filter_int(ue)),
|
||||
filter_eq(
|
||||
filter_evfun(database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(database, event, "rnti")),
|
||||
filter_int(ue)),
|
||||
filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0))));
|
||||
}
|
||||
|
||||
@@ -148,23 +187,28 @@ static void set_current_ue(gui *g, enb_data *e, int ue)
|
||||
|
||||
logger_set_filter(e->e->pusch_iq_ue_logger,
|
||||
filter_eq(
|
||||
filter_evarg(e->database, "ENB_PHY_PUSCH_IQ", "UE_ID"),
|
||||
filter_evfun(e->database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(e->database, "ENB_PHY_PUSCH_IQ", "rnti")),
|
||||
filter_int(ue)));
|
||||
logger_set_filter(e->e->ul_estimate_ue_logger,
|
||||
filter_eq(
|
||||
filter_evarg(e->database, "ENB_PHY_UL_CHANNEL_ESTIMATE", "UE_ID"),
|
||||
filter_evfun(e->database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(e->database, "ENB_PHY_UL_CHANNEL_ESTIMATE", "rnti")),
|
||||
filter_int(ue)));
|
||||
logger_set_filter(e->e->pucch1_energy_ue_threshold_logger,
|
||||
filter_eq(
|
||||
filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"),
|
||||
filter_evfun(e->database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "rnti")),
|
||||
filter_int(ue)));
|
||||
logger_set_filter(e->e->pucch1_energy_ue_energy_logger,
|
||||
filter_eq(
|
||||
filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"),
|
||||
filter_evfun(e->database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "rnti")),
|
||||
filter_int(ue)));
|
||||
logger_set_filter(e->e->pucch_iq_ue_logger,
|
||||
filter_eq(
|
||||
filter_evarg(e->database, "ENB_PHY_PUCCH_1AB_IQ", "UE_ID"),
|
||||
filter_evfun(e->database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(e->database, "ENB_PHY_PUCCH_1AB_IQ", "rnti")),
|
||||
filter_int(ue)));
|
||||
for (i = 0; i < 8; i++) {
|
||||
logger_set_filter(e->e->dl_dci_logger[i],
|
||||
@@ -185,11 +229,13 @@ static void set_current_ue(gui *g, enb_data *e, int ue)
|
||||
}
|
||||
logger_set_filter(e->e->dl_mcs_logger,
|
||||
filter_eq(
|
||||
filter_evarg(e->database, "ENB_PHY_DLSCH_UE_DCI", "UE_id"),
|
||||
filter_evfun(e->database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(e->database, "ENB_PHY_DLSCH_UE_DCI", "rnti")),
|
||||
filter_int(ue)));
|
||||
logger_set_filter(e->e->ul_mcs_logger,
|
||||
filter_eq(
|
||||
filter_evarg(e->database, "ENB_PHY_ULSCH_UE_DCI", "UE_id"),
|
||||
filter_evfun(e->database, ue_id_from_rnti, NULL,
|
||||
filter_evarg(e->database, "ENB_PHY_ULSCH_UE_DCI", "rnti")),
|
||||
filter_int(ue)));
|
||||
}
|
||||
|
||||
@@ -205,6 +251,7 @@ static void click(void *private, gui *g,
|
||||
if (button != 1) return;
|
||||
if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; }
|
||||
if (w == e->next_ue_button) ue++;
|
||||
if (w == e->current_ue_button) reset_ue_ids();
|
||||
|
||||
if (pthread_mutex_lock(&ed->lock)) abort();
|
||||
if (ue != ed->ue) {
|
||||
@@ -248,10 +295,12 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database,
|
||||
widget_add_child(g, col, logo, -1);
|
||||
w = new_container(g, HORIZONTAL);
|
||||
widget_add_child(g, col, w, -1);
|
||||
/* TODO: use button widget, not label widget */
|
||||
w2 = new_label(g, "");
|
||||
widget_add_child(g, w, w2, -1);
|
||||
label_set_clickable(g, w2, 1);
|
||||
e->current_ue_button = w2;
|
||||
e->current_ue_label = w2;
|
||||
/* TODO: use button widget, not label widget */
|
||||
w2 = new_label(g, " [prev UE] ");
|
||||
widget_add_child(g, w, w2, -1);
|
||||
label_set_clickable(g, w2, 1);
|
||||
@@ -590,6 +639,7 @@ static void enb_main_gui(enb_gui *e, gui *g, event_handler *h, void *database,
|
||||
e->legacy = new_view_textlist(10000, 10, g, text);
|
||||
|
||||
set_current_ue(g, ed, 0);
|
||||
register_notifier(g, "click", e->current_ue_button, click, ed);
|
||||
register_notifier(g, "click", e->prev_ue_button, click, ed);
|
||||
register_notifier(g, "click", e->next_ue_button, click, ed);
|
||||
}
|
||||
@@ -628,6 +678,8 @@ int main(int n, char **v)
|
||||
enb_gui eg;
|
||||
enb_data enb_data;
|
||||
|
||||
reset_ue_ids();
|
||||
|
||||
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ struct filter {
|
||||
struct { struct filter *a, *b; } op2;
|
||||
int v;
|
||||
struct { int event_type; int arg_index; } evarg;
|
||||
struct { int (*fun)(void *priv, int v); void *priv;
|
||||
struct filter *x; } evfun;
|
||||
} v;
|
||||
|
||||
int (*eval)(struct filter *this, event e);
|
||||
@@ -52,6 +54,11 @@ int eval_evarg(struct filter *f, event e)
|
||||
return e.e[f->v.evarg.arg_index].i;
|
||||
}
|
||||
|
||||
int eval_evfun(struct filter *f, event e)
|
||||
{
|
||||
return f->v.evfun.fun(f->v.evfun.priv, f->v.evfun.x->eval(f->v.evfun.x, e));
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* free memory functions */
|
||||
/****************************************************************************/
|
||||
@@ -63,6 +70,12 @@ void free_op2(struct filter *f)
|
||||
free(f);
|
||||
}
|
||||
|
||||
void free_evfun(struct filter *f)
|
||||
{
|
||||
free_filter(f->v.evfun.x);
|
||||
free(f);
|
||||
}
|
||||
|
||||
void free_noop(struct filter *f)
|
||||
{
|
||||
free(f);
|
||||
@@ -135,6 +148,19 @@ filter *filter_evarg(void *database, char *event_name, char *varname)
|
||||
return ret;
|
||||
}
|
||||
|
||||
filter *filter_evfun(void *database, int (*fun)(void *priv, int v),
|
||||
void *priv, filter *x)
|
||||
{
|
||||
struct filter *ret = calloc(1, sizeof(struct filter));
|
||||
if (ret == NULL) abort();
|
||||
ret->eval = eval_evfun;
|
||||
ret->free = free_evfun;
|
||||
ret->v.evfun.fun = fun;
|
||||
ret->v.evfun.priv = priv;
|
||||
ret->v.evfun.x = x;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void free_filter(filter *_f)
|
||||
{
|
||||
struct filter *f;
|
||||
|
||||
@@ -9,6 +9,8 @@ filter *filter_and(filter *a, filter *b);
|
||||
filter *filter_eq(filter *a, filter *b);
|
||||
filter *filter_int(int v);
|
||||
filter *filter_evarg(void *database, char *event_name, char *varname);
|
||||
filter *filter_evfun(void *database, int (*fun)(void *priv, int v),
|
||||
void *priv, filter *x);
|
||||
|
||||
int filter_eval(filter *f, event e);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user