mirror of
https://github.com/status-im/status-go.git
synced 2025-01-29 07:57:07 +00:00
e65760ca85
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.
54 lines
937 B
C
54 lines
937 B
C
#ifndef _SYS_MSG_H
|
|
#define _SYS_MSG_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#define __NEED_pid_t
|
|
#define __NEED_key_t
|
|
#define __NEED_time_t
|
|
#define __NEED_size_t
|
|
#define __NEED_ssize_t
|
|
|
|
#include <bits/alltypes.h>
|
|
|
|
typedef unsigned long msgqnum_t;
|
|
typedef unsigned long msglen_t;
|
|
|
|
#include <bits/msg.h>
|
|
|
|
#define __msg_cbytes msg_cbytes
|
|
|
|
#define MSG_NOERROR 010000
|
|
#define MSG_EXCEPT 020000
|
|
|
|
#define MSG_STAT (11 | (IPC_STAT & 0x100))
|
|
#define MSG_INFO 12
|
|
#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
|
|
|
|
struct msginfo {
|
|
int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
|
|
unsigned short msgseg;
|
|
};
|
|
|
|
int msgctl (int, int, struct msqid_ds *);
|
|
int msgget (key_t, int);
|
|
ssize_t msgrcv (int, void *, size_t, long, int);
|
|
int msgsnd (int, const void *, size_t, int);
|
|
|
|
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
|
struct msgbuf {
|
|
long mtype;
|
|
char mtext[1];
|
|
};
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|