The local protocol gets media-key: each side sends its ephemeral X25519 public key (base64) and UDP port over the ready text connection; both derive the direction keys with HKDF-SHA256, the caller is the initiator. localui sends the key on Conversation > Call, answers an offer with its own key, creates the call with dc_call_new_bound on the listener port (TLS and media share the number), rings, and opens the call window; an incoming ring enables Answer. The Xt loop pumps the call: drain, Opus decode to the playback stream, capture and encode only while our own PTT is held, video frames to the window, ring timeout. dc_local_conn_remote_addr gives the numeric peer address; dc_call_new_bound binds the announced port. dc_call_talking() is now only our own key, dc_call_peer_talking() the peer's (a received PTT used to start our microphone too). The call window has an Answer button and lays the buttons above the video so they stay visible. --call-first and DTCHAT_TEST_TRUST/DTCHAT_TEST_AUTOANSWER/DTCHAT_TEST_PTT drive the test: two UI instances auto-paired, exchanged media-key, rang, answered, reached IN_CALL and carried 200 Opus frames caller->callee with the callee silent (audio out 200 on the receiver, audio in 200 on the sender); screenshot build/mcde-shots/dtchat-t65-live.png. The smoke still passes; test_media_call uses peer_talking; test_media_packet covers the base64 key exchange. The test switch is documented in the security review.
27 lines
895 B
C
27 lines
895 B
C
/*
|
|
* localui.h -- the UI side of the local peer mode
|
|
*
|
|
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
*/
|
|
#ifndef _Dtchat_localui_h
|
|
#define _Dtchat_localui_h
|
|
|
|
#include "ui_main.h"
|
|
#include "dc_internal.h"
|
|
|
|
typedef struct DtLocal DtLocal;
|
|
|
|
/*
|
|
* Start the listener, the manual peer links, the pin store and the UI hooks.
|
|
* PEERS is owned by the manager (the caller must not free it while running).
|
|
* Returns NULL when the identity or the listener cannot be set up.
|
|
*/
|
|
DtLocal *dtchat_local_start(DtChatUi *ui, DcModel *model, DcPeers *peers,
|
|
const char *config_dir, const char *listen_text,
|
|
const char *const *peer_text, int npeers, const char *downloads_dir);
|
|
void dtchat_local_stop(DtLocal *local);
|
|
/* call the first online peer, for --call-first (a test convenience) */
|
|
int dtchat_local_call_first(DtLocal *local);
|
|
|
|
#endif /* _Dtchat_localui_h */
|