summaryrefslogtreecommitdiffstats
path: root/src/roof.h
blob: 316e8ed0e524c4d98f2d32a8442b6e761d16b22c (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef __ROOF_H
#define __ROOF_H

typedef struct _Roof Roof;

#include "roof-config.h"
#include "roof-buffer.h"
#include "roof-read.h"
#include "roof-thread.h"

struct _Roof {
    RoofConfig			*cfg;                                   // Parsed ROOF parameters
    RoofBuffer			*buf;                                   // Ring buffer for incomming UDP packet
    RoofReadInterface		**rdi;					// Reader interface abstraction, one per socket (no threading)
    RoofReadContext		**rdc;					// Reader context: common structures, one per socket (no threading)
    RoofThread			**rdt;					// Threading context: multiple reader contexts per thread

    guint                       n_threads;                              // Number of schedulled threads
    HWSched                     sched;					// OpenMP-style thread scheduler

    gboolean                    simulate;                               // Indicates if we are running in network or simulation modes
    gchar                       *path;                                  // UFO file path for simulation mode
    guint                       first_file_number;                      // Number of a first simulated file (0 or 1)

    guint                       max_datasets;                           // Number of datasets to read

//    guint64 			announced;				// For debugging
//    guint64			generated;				// Total number for control

//    struct timespec		last_fragment_timestamp;

};


Roof *roof_new(RoofConfig *cfg, GError **error);
void roof_free(Roof *ctx);

void roof_configure_simulation(Roof *ctx, const gchar *path, guint first_file_number, GError **error);
void roof_configure_stop_mode(Roof *ctx, const gulong max, GError **error);
//void roof_configure_writer(Roof *ctx, ...);
//void roof_configure_filter(Roof *ctx, ...);
void roof_setup(Roof *ctx, GError **error);

void roof_read(Roof *ctx, void *buffer, GError **error);

#endif