1
0
mirror of https://github.com/CPunch/Laika.git synced 2026-02-09 01:30:03 +00:00

Refactored LAIKAPKT_HANDSHAKE_REQ, laikaS_acceptFrom

- added inet member to peer structs
This commit is contained in:
2022-03-04 20:17:03 -06:00
parent 12a1329101
commit 0c2d4968d9
11 changed files with 59 additions and 36 deletions

View File

@@ -2,7 +2,7 @@
#include "lpacket.h"
#include "speer.h"
tShell_peer *shellP_newPeer(PEERTYPE type, uint8_t *pubKey, char *hostname, char *ipv4) {
tShell_peer *shellP_newPeer(PEERTYPE type, uint8_t *pubKey, char *hostname, char *inet, char *ipv4) {
tShell_peer *peer = (tShell_peer*)laikaM_malloc(sizeof(tShell_peer));
peer->type = type;
@@ -11,11 +11,13 @@ tShell_peer *shellP_newPeer(PEERTYPE type, uint8_t *pubKey, char *hostname, char
/* copy hostname & ipv4 */
memcpy(peer->hostname, hostname, LAIKA_HOSTNAME_LEN);
memcpy(peer->inet, inet, LAIKA_IPV4_LEN);
memcpy(peer->ipv4, ipv4, LAIKA_IPV4_LEN);
/* restore NULL terminators */
peer->hostname[LAIKA_HOSTNAME_LEN-1] = 0;
peer->ipv4[LAIKA_IPV4_LEN-1] = 0;
peer->hostname[LAIKA_HOSTNAME_LEN-1] = '\0';
peer->inet[LAIKA_INET_LEN-1] = '\0';
peer->ipv4[LAIKA_IPV4_LEN-1] = '\0';
return peer;
}