summaryrefslogtreecommitdiffstats
path: root/PICA_node.h
diff options
context:
space:
mode:
authorAnton <anton@picapica.im>2026-11-24 02:40:10 +0400
committerAnton <anton@picapica.im>2026-11-24 02:40:10 +0400
commit48417c1da102dc9eb332227237805b8e28f81f97 (patch)
tree53defd47a60bf505a3431a0ae4193b1e40b29c2e /PICA_node.h
parent3922dcc4c4822cc626d62f73ddefbe4fce8e94e5 (diff)
parent98d341e2e55852f075001c6c2d084d025a97383f (diff)
downloadpica-pica-48417c1da102dc9eb332227237805b8e28f81f97.tar.gz
pica-pica-48417c1da102dc9eb332227237805b8e28f81f97.zip
Merge branch 'audio_video_calls'
Diffstat (limited to 'PICA_node.h')
-rw-r--r--PICA_node.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/PICA_node.h b/PICA_node.h
index 78cb997..82ddb32 100644
--- a/PICA_node.h
+++ b/PICA_node.h
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/select.h>
@@ -51,6 +52,7 @@
#include <time.h>
#include "PICA_nodeaddrlist.h"
#include "PICA_id.h"
+#include "PICA_proto.h"
#include <event2/event.h>
@@ -102,6 +104,15 @@
#define DEFAULT_BUF_SIZE 4096
+//Relay buffers of a c2c link. procmsg_N2NMSG() drops the whole link when an
+//incoming N2NMSG does not fit into the free space left in these, and the
+//announced payload length of an N2NMSG is a 16 bit field less the two peer ids
+//(65535 - 2 * PICA_ID_SIZE), so anything below 64K makes that a routine event
+//instead of an exceptional one - a link carrying a call has a backlog in both
+//directions most of the time. Deliberately not DEFAULT_BUF_SIZE: that one is
+//also the r_buf/w_buf granularity paid for by every connected client.
+#define C2C_BUF_SIZE 65536
+
struct nodelink;
struct client
@@ -132,6 +143,16 @@ struct client
int disconnect_ticking;//on sending message TO client this var is set to 1, on receiving some message FROM client this var is reset to 0
struct event *ev_read;
struct event *ev_write;
+
+ //Pending "get my UDP address" request. The token is what ties a datagram
+ //arriving at the UDP socket to this connection, see process_udp_read()
+ unsigned char udpaddr_token[PICA_PROTO_MYUDPADDR_TOKENSIZE];
+ int udpaddr_token_issued;
+ time_t udpaddr_token_tmst;
+ struct client *udpaddr_token_next;//next client in the same bucket of udpaddr_tokens[]
+ //how many more MYUDPADDRREQ messages are served right now, see client_udpaddr_req_allowed()
+ unsigned int udpaddr_req_allowance;
+ time_t udpaddr_req_tmst;
};
struct cclink //структура, описывающая соединение двух клиентов между собой через сервер