1 | #ifndef BRPAQU_H_SEEN
|
---|
2 | #define BRPAQU_H_SEEN
|
---|
3 |
|
---|
4 | /* ----------------------------------------
|
---|
5 | Projet BAORadio --- LAL
|
---|
6 | Juin 2008 , M.Taurigna , R. Ansari
|
---|
7 | ------------------------------------------- */
|
---|
8 |
|
---|
9 | #include <stdio.h>
|
---|
10 | #include <iostream>
|
---|
11 | #include <string>
|
---|
12 | #include "brtypes.h"
|
---|
13 |
|
---|
14 | using namespace std;
|
---|
15 |
|
---|
16 | // Taille entete/trailer en octets
|
---|
17 | #define BRHDRSIZE 24
|
---|
18 | // Actuellement le trailer est vire ...
|
---|
19 | /* #define BRTRLSIZE 16 */
|
---|
20 | #define BRTRLSIZE 0
|
---|
21 | // Offset du time-tag
|
---|
22 | #define BRTMTAGOFF 8
|
---|
23 |
|
---|
24 | // Structure correspondant a HEADER-DATA-TRAILER
|
---|
25 | class BRPaquet {
|
---|
26 | public:
|
---|
27 | BRPaquet(Byte* src, Byte* dst, int paqsz=4096);
|
---|
28 | // ~BRPaquet();
|
---|
29 |
|
---|
30 | // Acces diverses tailles
|
---|
31 | inline int PaquetSize() { return sz_; }
|
---|
32 | inline int DataSize() { return sz_-(BRHDRSIZE+BRTRLSIZE); }
|
---|
33 |
|
---|
34 | inline int HeaderSize() { return BRHDRSIZE; }
|
---|
35 | inline int TrailerSize() { return BRTRLSIZE; }
|
---|
36 |
|
---|
37 | // Acces differentes zone memoire
|
---|
38 | inline Byte* Data() { return dst_+BRHDRSIZE; }
|
---|
39 | inline Byte* Header() { return dst_; }
|
---|
40 | inline Byte* Trailer() { return (dst_+sz_-BRTRLSIZE); }
|
---|
41 |
|
---|
42 | // Valeurs differentes zones HDR/TRL
|
---|
43 | inline UInt64 HDRMarker() {return *((UInt64*)dst_);}
|
---|
44 | inline UInt64 TRLMarker() {return *((UInt64*)(dst_+sz_-BRTRLSIZE));}
|
---|
45 | inline UInt64 TimeTag() {return *((UInt64*)(dst_+BRTMTAGOFF));}
|
---|
46 |
|
---|
47 | // pour faire un print de la structure
|
---|
48 | void Print(ostream & os, int nelt=8, bool prht=true);
|
---|
49 |
|
---|
50 | // protected:
|
---|
51 | // donnees membres
|
---|
52 | int sz_; //taille du paquet
|
---|
53 | Byte* dst_;
|
---|
54 | };
|
---|
55 |
|
---|
56 | #endif
|
---|