36#ifndef GNUNET_CORE_SERVICE_H
37#define GNUNET_CORE_SERVICE_H
53#define GNUNET_CORE_SVC_INFO_LEN 64
221#define GNUNET_CORE_VERSION 0x00000001
225#define CONG_CRYPTO_ENABLED 0
279#if CONG_CRYPTO_ENABLED
295 unsigned char nonce[crypto_aead_xchacha20poly1305_ietf_NPUBBYTES];
304 unsigned char tag[crypto_aead_xchacha20poly1305_ietf_ABYTES];
332 unsigned char nonce[crypto_aead_xchacha20poly1305_ietf_NPUBBYTES];
341 unsigned char tag[crypto_aead_xchacha20poly1305_ietf_ABYTES];
458typedef void *(*GNUNET_CORE_ConnectEventHandler) (
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MQ_Handle * mq
void * connects(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
void disconnects(void *cls, const struct GNUNET_PeerIdentity *peer)
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static char * init
Set to the name of a service to start.
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
static struct GNUNET_CADET_Handle * mh
Cadet handle.
struct GNUNET_PeerIdentity my_identity
Our peer identity.
enum State state
current state of profiling
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
void(* GNUNET_CORE_DisconnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
Method called whenever a peer disconnects.
void(* GNUNET_CORE_MonitorCallback)(void *cls, const struct GNUNET_PeerIdentity *pid, enum GNUNET_CORE_KxState state, struct GNUNET_TIME_Absolute timeout)
Function called by the monitor callback whenever a peer's connection status changes.
GNUNET_CORE_PeerClass
The peer class gives a hint about the capabilities of a peer.
struct GNUNET_CORE_Handle * GNUNET_CORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers, struct GNUNET_CORE_ServiceInfo *service_info)
Connect to the core service.
GNUNET_CORE_Service
Identifiers for services that communicate over CORE.
GNUNET_CORE_KxState
TODO how does this harmonize with CAKE_CRYPTO_ENABLED?
struct GNUNET_MQ_Handle * GNUNET_CORE_get_mq(const struct GNUNET_CORE_Handle *h, const struct GNUNET_PeerIdentity *pid)
Obtain the message queue for a connected peer.
void GNUNET_CORE_monitor_stop(struct GNUNET_CORE_MonitorHandle *mh)
Stop monitoring CORE activity.
void(* GNUNET_CORE_StartupCallback)(void *cls, const struct GNUNET_PeerIdentity *my_identity)
Function called after GNUNET_CORE_connect has succeeded (or failed for good).
void *(* GNUNET_CORE_ConnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq, enum GNUNET_CORE_PeerClass class)
Method called whenever a given peer connects.
struct GNUNET_CORE_MonitorHandle * GNUNET_CORE_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CORE_MonitorCallback peer_cb, void *peer_cb_cls)
Monitor connectivity and KX status of all peers known to CORE.
int GNUNET_CORE_is_peer_connected_sync(const struct GNUNET_CORE_Handle *h, const struct GNUNET_PeerIdentity *pid)
Check if the given peer is currently connected.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
@ GNUNET_CORE_CLASS_SERVER
This is something like a server.
@ GNUNET_CORE_CLASS_UNKNOWN
The device's capabilities are currently unknown.
@ GNUNET_CORE_CLASS_ROUTER
This is a piece of network infrastructure.
@ GNUNET_CORE_CLASS_MOBILE
This is a mobile device.
@ GNUNET_CORE_CLASS_DESKTOP
This is a desktop computer.
@ GNUNET_CORE_CLASS_UNWILLING
This device is currently unwilling to spend more then the absolutely necessary ressources.
@ GNUNET_CORE_SERVICE_TOPOLOGY
Identifier for topology service.
@ GNUNET_CORE_SERVICE_DHT
Identifier for dht (distributed hash table) service.
@ GNUNET_CORE_SERVICE_NSE
Identifier for nse (network size estimation) service.
@ GNUNET_CORE_SERVICE_CADET
Identifier for cadet service.
@ GNUNET_CORE_SERVICE_RPS
Identifier for rps (random peer sampling) service.
@ GNUNET_CORE_SERVICE_FS
Identifier for fs (file sharing) service.
@ GNUNET_CORE_SERVICE_REVOCATION
Identifier for revocation service.
@ GNUNET_CORE_SERVICE_TEST
Identifier for testing the api.
@ GNUNET_CORE_SERVICE_HOSTLIST
Identifier for hostlist service.
@ GNUNET_CORE_KX_PEER_DISCONNECT
Last state of a KX (when it is being terminated).
@ GNUNET_CORE_KX_STATE_RESPONDER_CONNECTED
Connected as responder.
@ GNUNET_CORE_KX_STATE_DOWN
No handshake yet.
@ GNUNET_CORE_KX_STATE_INITIATOR_DONE_SENT
We sent initiator done.
@ GNUNET_CORE_KX_CORE_DISCONNECT
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
@ GNUNET_CORE_KX_STATE_INITIATOR_HELLO_RECEIVED
We've received the initiator hello.
@ GNUNET_CORE_KX_STATE_AWAIT_INITIATION
We are awating the initiator hello.
@ GNUNET_CORE_KX_STATE_INITIATOR_CONNECTED
Connected as initiator.
@ GNUNET_CORE_KX_STATE_INITIATOR_HELLO_SENT
We sent the initiator hello.
@ GNUNET_CORE_KX_STATE_RESPONDER_HELLO_RECEIVED
We've received the initiator hello.
@ GNUNET_CORE_KX_STATE_RESPONDER_HELLO_SENT
We sent the responder hello.
@ GNUNET_CORE_KX_ITERATION_FINISHED
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
@ GNUNET_CORE_KX_STATE_REKEY_SENT
We're rekeying (or had a timeout), so we have sent the other peer our new ephemeral key,...
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
Message transmitted with the signed ephemeral key of a peer.
struct GNUNET_PeerIdentity origin_identity
Public key of the signing peer (persistent version, not the ephemeral public key).
struct GNUNET_MessageHeader header
Message type is #GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY.
int32_t sender_status
Status of the sender (should be in enum PeerStateMachine), nbo.
struct GNUNET_TIME_AbsoluteNBO expiration_time
When does the given ephemeral key expire (end of validity).
struct GNUNET_CRYPTO_EddsaSignature signature
An ECC signature of the origin_identity asserting the validity of the given ephemeral key.
struct GNUNET_TIME_AbsoluteNBO creation_time
At what time was this key created (beginning of validity).
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Information about what is being signed.
struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key
Ephemeral public ECC key.
Context for the core service connection.
void * cls
Closure for the various callbacks.
struct GNUNET_CORE_ServiceInfo service_info
Services info field for the connected service.
Handle to a CORE monitoring operation.
GNUNET_CORE_MonitorCallback peer_cb
Function called with the peer.
void * peer_cb_cls
Closure for peer_cb.
Gnunet service info - identifying compatibility with a range of version of a service communicating ov...
struct GNUNET_CORE_ServiceVersion version_max
Maximal compatible version number of service.
struct GNUNET_CORE_ServiceVersion version
Version of this service implementation.
enum GNUNET_CORE_Service service
Identifier of the service on top of CORE.
struct GNUNET_CORE_ServiceVersion version_min
Minimal compatible version number of service.
A gnunet service version for services above CORE TODO we might want to be compatible with https://sem...
uint32_t major
Major version number.
uint32_t minor
Minor version number.
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
an ECC signature using EdDSA.
Handle to a message queue.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for absolute times used by GNUnet, in microseconds.
We're sending an (encrypted) PING to the other peer to check if it can decrypt.
struct GNUNET_MessageHeader header
Message type is #GNUNET_MESSAGE_TYPE_CORE_PING.
uint32_t iv_seed
Seed for the IV.
struct GNUNET_PeerIdentity target
Intended target of the PING, used primarily to check that decryption actually worked.
uint32_t challenge
Random number chosen to make replay harder.
uint32_t challenge
Random number to make replay attacks harder.
struct GNUNET_MessageHeader header
Message type is #GNUNET_MESSAGE_TYPE_CORE_PONG.
uint32_t reserved
Reserved, always zero.
uint32_t iv_seed
Seed for the IV.
enum GNUNET_CORE_PeerClass peer_class
The peer class of the sending peer TODO is it correct to send an enum like this?
struct GNUNET_PeerIdentity target
Intended target of the PING, used primarily to check that decryption actually worked.