2021-07-27 16:06:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file peeridx_local.h
|
|
|
|
*
|
|
|
|
* `peerindex` private header.
|
|
|
|
*
|
|
|
|
* \copyright The DoubleFourteen Code Forge (C) All Rights Reserved
|
|
|
|
* \author Lorenzo Cogotti
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DF_PEERINDEX_LOCAL_H_
|
|
|
|
#define DF_PEERINDEX_LOCAL_H_
|
|
|
|
|
|
|
|
#include "bgp/mrt.h"
|
2021-10-15 12:18:35 +02:00
|
|
|
#include "bufio.h"
|
2021-07-27 16:06:19 +02:00
|
|
|
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
|
|
|
#define PEERREFSTABSIZ (0x10000uLL / 64)
|
|
|
|
|
|
|
|
typedef Uint64 PeerRefsTab[PEERREFSTABSIZ];
|
|
|
|
|
|
|
|
FORCE_INLINE void MARKPEERINDEX(PeerRefsTab tab, Uint16 idx)
|
|
|
|
{
|
|
|
|
tab[idx >> 6] |= (1uLL << (idx & 0x3f));
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCE_INLINE Boolean ISPEERINDEXREF(const PeerRefsTab tab, Uint16 idx)
|
|
|
|
{
|
|
|
|
return (tab[idx >> 6] & (1uLL << (idx & 0x3f))) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct {
|
2021-08-03 23:56:05 +02:00
|
|
|
// Output stream
|
|
|
|
void *outf;
|
|
|
|
const StmOps *outfOps;
|
|
|
|
|
2021-08-01 15:10:31 +02:00
|
|
|
// MRT input file stream
|
|
|
|
const char *filename;
|
|
|
|
void *inf;
|
|
|
|
const StmOps *infOps;
|
2021-10-15 12:18:35 +02:00
|
|
|
Stmrdbuf infBuf;
|
2021-07-27 16:06:19 +02:00
|
|
|
|
|
|
|
// Miscellaneous global flags and data
|
|
|
|
Boolean8 hasPeerIndex;
|
|
|
|
Uint8 peerIndexClearVal;
|
|
|
|
Uint16 npeers;
|
|
|
|
PeerRefsTab peerIndexRefs;
|
|
|
|
Mrtrecord peerIndex;
|
|
|
|
Mrtrecord rec;
|
|
|
|
|
|
|
|
// Error tracking and management
|
|
|
|
jmp_buf dropRecordFrame; // used by `Peerindex_DropRecord()`
|
|
|
|
jmp_buf dropFileFrame; // used by `Peerindex_DropFile()`
|
|
|
|
int nerrors; // for `exit()` status
|
|
|
|
} PeerindexState;
|
|
|
|
|
|
|
|
#endif
|