Andrea Maria Piana e65760ca85 Add basic peersyncing
This commit adds basic syncing capabilities with peers if they are both
online.

It updates the work done on MVDS, but I decided to create the code in
status-go instead, since it's very tight to the application (similarly
the code that was the inspiration for mvds, bramble, is all tight
together at the database level).

I reused parts of the protobufs.

The flow is:

1) An OFFER message is sent periodically with a bunch of message-ids and
   group-ids.
2) Anyone can REQUEST some of those messages if not present in their
   database.

3) The peer will then send over those messages.

It's disabled by default, but I am planning to add a way to set up the
flags.
2024-01-23 12:46:17 +00:00

73 lines
1.1 KiB
C

#ifndef _SYS_ACCT_H
#define _SYS_ACCT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#include <time.h>
#include <stdint.h>
#define ACCT_COMM 16
typedef uint16_t comp_t;
struct acct {
char ac_flag;
uint16_t ac_uid;
uint16_t ac_gid;
uint16_t ac_tty;
uint32_t ac_btime;
comp_t ac_utime;
comp_t ac_stime;
comp_t ac_etime;
comp_t ac_mem;
comp_t ac_io;
comp_t ac_rw;
comp_t ac_minflt;
comp_t ac_majflt;
comp_t ac_swaps;
uint32_t ac_exitcode;
char ac_comm[ACCT_COMM+1];
char ac_pad[10];
};
struct acct_v3 {
char ac_flag;
char ac_version;
uint16_t ac_tty;
uint32_t ac_exitcode;
uint32_t ac_uid;
uint32_t ac_gid;
uint32_t ac_pid;
uint32_t ac_ppid;
uint32_t ac_btime;
float ac_etime;
comp_t ac_utime;
comp_t ac_stime;
comp_t ac_mem;
comp_t ac_io;
comp_t ac_rw;
comp_t ac_minflt;
comp_t ac_majflt;
comp_t ac_swaps;
char ac_comm[ACCT_COMM];
};
#define AFORK 1
#define ASU 2
#define ACORE 8
#define AXSIG 16
#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN))
#define AHZ 100
int acct(const char *);
#ifdef __cplusplus
}
#endif
#endif