GNUnet  0.11.x
Data Structures | Functions | Variables
gnunet-service-core.h File Reference

Globals for gnunet-service-core. More...

#include "gnunet_statistics_service.h"
#include "gnunet_core_service.h"
#include "core.h"
#include "gnunet-service-core_typemap.h"
Include dependency graph for gnunet-service-core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GSC_ClientActiveRequest
 Record kept for each request for transmission issued by a client that is still pending. More...
 

Functions

void GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car)
 Tell a client that we are ready to receive the message. More...
 
void GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car, int drop_client)
 We will never be ready to transmit the given message in (disconnect or invalid request). More...
 
void GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, const struct GNUNET_PeerIdentity *neighbour, const struct GSC_TypeMap *tmap_old, const struct GSC_TypeMap *tmap_new)
 Notify a particular client about a change to existing connection to one of our neighbours (check if the client is interested). More...
 
void GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg, uint16_t msize, uint32_t options)
 Deliver P2P message to interested clients. More...
 
void GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity *neighbour, const struct GSC_TypeMap *tmap_old, const struct GSC_TypeMap *tmap_new)
 Notify all clients about a change to existing session. More...
 

Variables

const struct GNUNET_CONFIGURATION_HandleGSC_cfg
 Our configuration. More...
 
struct GNUNET_STATISTICS_HandleGSC_stats
 For creating statistics. More...
 
struct GNUNET_PeerIdentity GSC_my_identity
 Our identity. More...
 

Detailed Description

Globals for gnunet-service-core.

Author
Christian Grothoff

Definition in file gnunet-service-core.h.

Function Documentation

◆ GSC_CLIENTS_solicit_request()

void GSC_CLIENTS_solicit_request ( struct GSC_ClientActiveRequest car)

Tell a client that we are ready to receive the message.

Parameters
carrequest that is now ready; the responsibility for the handle remains shared between CLIENTS and SESSIONS after this call.

Definition at line 261 of file gnunet-service-core.c.

References GSC_ClientActiveRequest::client_handle, GSC_ClientActiveRequest::deadline, env, GNUNET_assert, GNUNET_CONSTANTS_LATENCY_WARN, GNUNET_CONTAINER_multipeermap_contains(), GNUNET_ERROR_TYPE_WARNING, GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_CORE_SEND_READY, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, GSC_CLIENTS_reject_request(), GSC_my_identity, GSC_SESSIONS_dequeue_request(), GSC_ClientActiveRequest::msize, SendMessageReady::peer, GSC_ClientActiveRequest::priority, GSC_ClientActiveRequest::received_time, GNUNET_TIME_Relative::rel_value_us, SendMessageReady::size, GSC_ClientActiveRequest::smr_id, SendMessageReady::smr_id, and GSC_ClientActiveRequest::target.

Referenced by handle_client_send_request(), and solicit_messages().

262 {
263  struct GSC_Client *c;
264  struct GNUNET_MQ_Envelope *env;
265  struct SendMessageReady *smr;
267  struct GNUNET_TIME_Relative left;
268 
269  c = car->client_handle;
270  if (GNUNET_YES !=
271  GNUNET_CONTAINER_multipeermap_contains (c->connectmap, &car->target))
272  {
273  /* connection has gone down since, drop request */
274  GNUNET_assert (0 != memcmp (&car->target,
276  sizeof(struct GNUNET_PeerIdentity)));
279  return;
280  }
284  GNUNET_log (
286  "Client waited %s for permission to transmit to `%s'%s (priority %u)\n",
288  GNUNET_i2s (&car->target),
289  (0 == left.rel_value_us) ? " (past deadline)" : "",
290  car->priority);
292  smr->size = htons (car->msize);
293  smr->smr_id = car->smr_id;
294  smr->peer = car->target;
295  GNUNET_MQ_send (c->mq, env);
296 }
struct GNUNET_TIME_Absolute deadline
By what time would the client want to see this message out?
uint64_t rel_value_us
The actual value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_CONSTANTS_LATENCY_WARN
After what amount of latency for a message do we print a warning?
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_NO
Definition: gnunet_common.h:78
uint16_t smr_id
Unique request ID (in big endian).
void GSC_CLIENTS_reject_request(struct GSC_ClientActiveRequest *car, int drop_client)
We will never be ready to transmit the given message in (disconnect or invalid request).
Data structure for each client connected to the CORE service.
Core notifying client that it is allowed to now transmit a message to the given target (response to G...
Definition: core.h:241
enum GNUNET_MQ_PriorityPreferences priority
How important is this request.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:687
struct GNUNET_PeerIdentity GSC_my_identity
Our identity.
#define GNUNET_MESSAGE_TYPE_CORE_SEND_READY
Confirmation from core that message can now be sent.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
uint16_t smr_id
smr_id from the request.
Definition: core.h:259
The identity of the host (wraps the signing key of the peer).
struct GSC_Client * client_handle
Handle to the client.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:375
#define GNUNET_log(kind,...)
void GSC_SESSIONS_dequeue_request(struct GSC_ClientActiveRequest *car)
Dequeue a request from a client from transmission to a particular peer.
#define GNUNET_YES
Definition: gnunet_common.h:77
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
struct GNUNET_TIME_Absolute received_time
At what time did we first see this request?
struct GNUNET_PeerIdentity target
Which peer is the message going to be for?
int GNUNET_CONTAINER_multipeermap_contains(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Check if the map contains any value under the given key (including values that are NULL)...
struct GNUNET_PeerIdentity peer
Identity of the intended target.
Definition: core.h:264
uint16_t size
How many bytes are allowed for transmission? Guaranteed to be at least as big as the requested size...
Definition: core.h:254
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
uint16_t msize
How many bytes does the client intend to send?
Time for relative time used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSC_CLIENTS_reject_request()

void GSC_CLIENTS_reject_request ( struct GSC_ClientActiveRequest car,
int  drop_client 
)

We will never be ready to transmit the given message in (disconnect or invalid request).

Frees resources associated with car. We don't explicitly tell the client, it'll learn with the disconnect (or violated the protocol).

Parameters
carrequest that now permanently failed; the responsibility for the handle is now returned to CLIENTS (SESSIONS is done with it).
drop_clientGNUNET_YES if the client violated the protocol and we should thus drop the connection

Definition at line 239 of file gnunet-service-core.c.

References GSC_Client::client, GSC_ClientActiveRequest::client_handle, GNUNET_assert, GNUNET_CONTAINER_multipeermap_remove(), GNUNET_free, GNUNET_SERVICE_client_drop(), GNUNET_YES, GSC_Client::requests, and GSC_ClientActiveRequest::target.

Referenced by GSC_CLIENTS_solicit_request(), GSC_SESSIONS_end(), and GSC_SESSIONS_queue_request().

241 {
242  GNUNET_assert (
243  GNUNET_YES ==
245  &car->target,
246  car));
247  if (GNUNET_YES == drop_client)
249  GNUNET_free (car);
250 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
struct GNUNET_CONTAINER_MultiPeerMap * requests
Map of peer identities to active transmission requests of this client to the peer (of type struct GSC...
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2324
struct GSC_Client * client_handle
Handle to the client.
struct GNUNET_SERVICE_Client * client
Handle for the client with the server API.
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_PeerIdentity target
Which peer is the message going to be for?
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSC_CLIENTS_notify_client_about_neighbour()

void GSC_CLIENTS_notify_client_about_neighbour ( struct GSC_Client client,
const struct GNUNET_PeerIdentity neighbour,
const struct GSC_TypeMap tmap_old,
const struct GSC_TypeMap tmap_new 
)

Notify a particular client about a change to existing connection to one of our neighbours (check if the client is interested).

Called from GSC_SESSIONS_notify_client_about_sessions().

Parameters
clientclient to notify
neighbouridentity of the neighbour that changed status
tmap_oldprevious type map for the neighbour, NULL for connect
tmap_newupdated type map for the neighbour, NULL for disconnect

Definition at line 645 of file gnunet-service-core.c.

References GSC_Client::connectmap, env, GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_contains(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_CONTAINER_multipeermap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT, GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_YES, GSC_Client::got_init, GSC_TYPEMAP_test_match(), GSC_Client::mq, ConnectNotifyMessage::peer, DisconnectNotifyMessage::peer, ConnectNotifyMessage::reserved, DisconnectNotifyMessage::reserved, GSC_Client::tcnt, and GSC_Client::types.

Referenced by GSC_CLIENTS_notify_clients_about_neighbour(), and notify_client_about_session().

650 {
651  struct GNUNET_MQ_Envelope *env;
652  int old_match;
653  int new_match;
654 
655  if (GNUNET_YES != client->got_init)
656  return;
657  old_match = GSC_TYPEMAP_test_match (tmap_old, client->types, client->tcnt);
658  new_match = GSC_TYPEMAP_test_match (tmap_new, client->types, client->tcnt);
660  "Notifying client about neighbour %s (%d/%d)\n",
661  GNUNET_i2s (neighbour),
662  old_match,
663  new_match);
664  if (old_match == new_match)
665  {
666  GNUNET_assert (
667  old_match ==
669  return; /* no change */
670  }
671  if (GNUNET_NO == old_match)
672  {
673  struct ConnectNotifyMessage *cnm;
674 
675  /* send connect */
676  GNUNET_assert (
677  GNUNET_NO ==
681  client->connectmap,
682  neighbour,
683  NULL,
686  cnm->reserved = htonl (0);
688  "Sending NOTIFY_CONNECT message about peer %s to client.\n",
689  GNUNET_i2s (neighbour));
690  cnm->peer = *neighbour;
691  GNUNET_MQ_send (client->mq, env);
692  }
693  else
694  {
695  struct DisconnectNotifyMessage *dcm;
696 
697  /* send disconnect */
698  GNUNET_assert (
699  GNUNET_YES ==
703  neighbour,
704  NULL));
706  dcm->reserved = htonl (0);
708  "Sending NOTIFY_DISCONNECT message about peer %s to client.\n",
709  GNUNET_i2s (neighbour));
710  dcm->peer = *neighbour;
711  GNUNET_MQ_send (client->mq, env);
712  }
713 }
uint32_t reserved
Always zero.
Definition: core.h:134
unsigned int tcnt
Number of types of incoming messages this client specifically cares about.
struct GNUNET_CONTAINER_MultiPeerMap * connectmap
Map containing all peers that this client knows we're connected to.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Message sent by the service to clients to notify them about a peer connecting.
Definition: core.h:124
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
int GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT
Notify clients about peer disconnecting.
struct GNUNET_PeerIdentity peer
Identity of the connecting peer.
Definition: core.h:139
There must only be one value per key; storing a value should fail if a value under the same key alrea...
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT
Notify clients about new peer-to-peer connections (triggered after key exchange). ...
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
int GSC_TYPEMAP_test_match(const struct GSC_TypeMap *tmap, const uint16_t *types, unsigned int tcnt)
Test if any of the types from the types array is in the given type map.
uint32_t reserved
Always zero.
Definition: core.h:157
uint16_t * types
Array of the types of messages this peer cares about (with tcnt entries).
#define GNUNET_log(kind,...)
Message sent by the service to clients to notify them about a peer disconnecting. ...
Definition: core.h:147
struct GNUNET_PeerIdentity peer
Identity of the connecting peer.
Definition: core.h:162
#define GNUNET_YES
Definition: gnunet_common.h:77
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
int GNUNET_CONTAINER_multipeermap_contains(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Check if the map contains any value under the given key (including values that are NULL)...
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GNUNET_MQ_Handle * mq
Message queue to talk to client.
int got_init
Have we gotten the GNUNET_MESSAGE_TYPE_CORE_INIT message from this client already?
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSC_CLIENTS_deliver_message()

void GSC_CLIENTS_deliver_message ( const struct GNUNET_PeerIdentity sender,
const struct GNUNET_MessageHeader msg,
uint16_t  msize,
uint32_t  options 
)

Deliver P2P message to interested clients.

Caller must have checked that the sending peer actually lists the given message type as one of its types.

Parameters
senderpeer who sent us the message
msgthe message
msizenumber of bytes to transmit
optionsoptions for checking which clients should receive the message

Definition at line 753 of file gnunet-service-core.c.

References all_client_options, buf, env, gettext_noop, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multipeermap_contains(), GNUNET_CORE_OPTION_SEND_FULL_INBOUND, GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND, GNUNET_CORE_OPTION_SEND_HDR_INBOUND, GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND, GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND, GNUNET_MQ_get_length(), GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_snprintf(), GNUNET_STATISTICS_update(), GNUNET_YES, GSC_SESSIONS_add_to_typemap(), HARD_MAX_QUEUE, GSC_Client::next, NotifyTrafficMessage::peer, size, GNUNET_MessageHeader::size, SOFT_MAX_QUEUE, GNUNET_MessageHeader::type, and type_match().

Referenced by deliver_message(), and tokenized_cb().

757 {
758  size_t size = msize + sizeof(struct NotifyTrafficMessage);
759 
760  if (size >= GNUNET_MAX_MESSAGE_SIZE)
761  {
762  GNUNET_break (0);
763  return;
764  }
765  if (! ((0 != (all_client_options & options)) ||
766  (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND))))
767  return; /* no client cares about this message notification */
769  "Core service passes message from `%s' of type %u to client.\n",
770  GNUNET_i2s (sender),
771  (unsigned int) ntohs (msg->type));
772  GSC_SESSIONS_add_to_typemap (sender, ntohs (msg->type));
773 
774  for (struct GSC_Client *c = client_head; NULL != c; c = c->next)
775  {
776  struct GNUNET_MQ_Envelope *env;
777  struct NotifyTrafficMessage *ntm;
778  uint16_t mtype;
779  unsigned int qlen;
780  int tm;
781 
782  tm = type_match (ntohs (msg->type), c);
783  if (! ((0 != (c->options & options)) ||
784  ((0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) &&
785  (GNUNET_YES == tm))))
786  continue; /* neither options nor type match permit the message */
787  if ((0 != (options & GNUNET_CORE_OPTION_SEND_HDR_INBOUND)) &&
788  ((0 != (c->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) ||
789  (GNUNET_YES == tm)))
790  continue;
791  if ((0 != (options & GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND)) &&
792  (0 != (c->options & GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND)))
793  continue;
794 
795  /* Drop messages if:
796  1) We are above the hard limit, or
797  2) We are above the soft limit, and a coin toss limited
798  to the message size (giving larger messages a
799  proportionally higher chance of being queued) falls
800  below the threshold. The threshold is based on where
801  we are between the soft and the hard limit, scaled
802  to match the range of message sizes we usually encounter
803  (i.e. up to 32k); so a 64k message has a 50% chance of
804  being kept if we are just barely below the hard max,
805  and a 99% chance of being kept if we are at the soft max.
806  The reason is to make it more likely to drop control traffic
807  (ACK, queries) which may be cummulative or highly redundant,
808  and cheap to drop than data traffic. */qlen = GNUNET_MQ_get_length (c->mq);
809  if ((qlen >= HARD_MAX_QUEUE) ||
810  ((qlen > SOFT_MAX_QUEUE) &&
812  ntohs (msg->size))) <
813  (qlen - SOFT_MAX_QUEUE) * 0x8000
815  {
816  char buf[1024];
817 
818  GNUNET_log (
820  "Dropping decrypted message of type %u as client is too busy (queue full)\n",
821  (unsigned int) ntohs (msg->type));
822  GNUNET_snprintf (buf,
823  sizeof(buf),
824  gettext_noop (
825  "# messages of type %u discarded (client busy)"),
826  (unsigned int) ntohs (msg->type));
828  continue;
829  }
830 
831  GNUNET_log (
833  "Sending %u message with %u bytes to client interested in messages of type %u.\n",
834  options,
835  ntohs (msg->size),
836  (unsigned int) ntohs (msg->type));
837 
838  if (0 != (options & (GNUNET_CORE_OPTION_SEND_FULL_INBOUND
839  | GNUNET_CORE_OPTION_SEND_HDR_INBOUND)))
841  else
843  env = GNUNET_MQ_msg_extra (ntm, msize, mtype);
844  ntm->peer = *sender;
845  GNUNET_memcpy (&ntm[1], msg, msize);
846 
847  GNUNET_assert (
848  (0 == (c->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) ||
849  (GNUNET_YES != tm) ||
850  (GNUNET_YES ==
851  GNUNET_CONTAINER_multipeermap_contains (c->connectmap, sender)));
852  GNUNET_MQ_send (c->mq, env);
853  }
854 }
struct GSC_Client * next
Clients are kept in a linked list.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
int GNUNET_snprintf(char *buf, size_t size, const char *format,...)
Like snprintf, just aborts if the buffer is of insufficient size.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GSC_Client * client_head
Head of linked list of our clients.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND
Notify clients about incoming P2P messages.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_STATISTICS_Handle * GSC_stats
For creating statistics.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Data structure for each client connected to the CORE service.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
#define SOFT_MAX_QUEUE
How many messages do we queue up at most for any client? This can cause messages to be dropped if cli...
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
unsigned int GNUNET_MQ_get_length(struct GNUNET_MQ_Handle *mq)
Obtain the current length of the message queue.
Definition: mq.c:335
#define GNUNET_CORE_OPTION_SEND_FULL_INBOUND
Client wants all inbound messages in full.
Definition: core.h:55
static char buf[2048]
#define GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND
Client wants all outbound messages in full.
Definition: core.h:66
static unsigned int size
Size of the "table".
Definition: peer.c:67
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND
Notify clients about outgoing P2P transmissions.
static int type_match(uint16_t type, struct GSC_Client *c)
Test if the client is interested in messages of the given type.
#define GNUNET_log(kind,...)
void GSC_SESSIONS_add_to_typemap(const struct GNUNET_PeerIdentity *peer, uint16_t type)
The given peer send a message of the specified type.
Message sent by the service to clients to notify them about messages being received or transmitted...
Definition: core.h:175
static uint32_t all_client_options
Big "or" of all client options.
#define GNUNET_YES
Definition: gnunet_common.h:77
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
#define GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND
Client just wants the 4-byte message headers of all outbound messages.
Definition: core.h:72
#define GNUNET_CORE_OPTION_SEND_HDR_INBOUND
Client just wants the 4-byte message headers of all inbound messages.
Definition: core.h:61
int GNUNET_CONTAINER_multipeermap_contains(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Check if the map contains any value under the given key (including values that are NULL)...
#define HARD_MAX_QUEUE
How many messages do we queue up at most for any client? This can cause messages to be dropped if cli...
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GNUNET_PeerIdentity peer
Identity of the receiver or sender.
Definition: core.h:186
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSC_CLIENTS_notify_clients_about_neighbour()

void GSC_CLIENTS_notify_clients_about_neighbour ( const struct GNUNET_PeerIdentity neighbour,
const struct GSC_TypeMap tmap_old,
const struct GSC_TypeMap tmap_new 
)

Notify all clients about a change to existing session.

Called from SESSIONS whenever there is a change in sessions or types processed by the respective peer.

Parameters
neighbouridentity of the neighbour that changed status
tmap_oldprevious type map for the neighbour, NULL for connect
tmap_newupdated type map for the neighbour, NULL for disconnect

Definition at line 726 of file gnunet-service-core.c.

References GSC_CLIENTS_notify_client_about_neighbour(), and GSC_Client::next.

Referenced by GSC_SESSIONS_add_to_typemap(), GSC_SESSIONS_create(), GSC_SESSIONS_end(), and GSC_SESSIONS_set_typemap().

730 {
731  struct GSC_Client *c;
732 
733  for (c = client_head; NULL != c; c = c->next)
735  neighbour,
736  tmap_old,
737  tmap_new);
738 }
struct GSC_Client * next
Clients are kept in a linked list.
static struct GSC_Client * client_head
Head of linked list of our clients.
Data structure for each client connected to the CORE service.
void GSC_CLIENTS_notify_client_about_neighbour(struct GSC_Client *client, const struct GNUNET_PeerIdentity *neighbour, const struct GSC_TypeMap *tmap_old, const struct GSC_TypeMap *tmap_new)
Notify a particular client about a change to existing connection to one of our neighbours (check if t...
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ GSC_cfg

const struct GNUNET_CONFIGURATION_Handle* GSC_cfg

Our configuration.

Definition at line 121 of file gnunet-service-core.c.

Referenced by GSC_KX_init(), and sign_ephemeral_key().

◆ GSC_stats

struct GNUNET_STATISTICS_Handle* GSC_stats

◆ GSC_my_identity

struct GNUNET_PeerIdentity GSC_my_identity