1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-09-26 03:40:05 +00:00

Removed unused content streams

This commit is contained in:
2022-06-26 19:02:21 -05:00
parent 43ef603301
commit ca0543fe90
9 changed files with 0 additions and 350 deletions

View File

@@ -35,7 +35,5 @@ struct sLaika_socket;
struct sLaika_pollList;
struct sLaika_task;
struct sLaika_taskService;
struct sLaika_content;
struct sLaika_contentContext;
#endif

View File

@@ -1,65 +0,0 @@
#ifndef LAIKA_CONTENT_H
#define LAIKA_CONTENT_H
#include "laika.h"
#include "lpacket.h"
#include <stdio.h>
#include <inttypes.h>
enum {
CONTENT_IN = true, /* being recv'd from peer */
CONTENT_OUT = false /* being sent to peer */
};
enum {
CONTENT_TYPE_FILE
};
enum {
CONTENT_ERR_ID_IN_USE,
CONTENT_ERR_INVALID_ID,
CONTENT_ERR_REJECTED
};
typedef uint8_t CONTENT_TYPE;
typedef uint8_t CONTENT_ERRCODE;
typedef uint16_t CONTENT_ID;
typedef void (*contentRecvEvent)(struct sLaika_peer *peer, struct sLaika_contentContext *context, struct sLaika_content *content);
typedef bool (*contentNewEvent)(struct sLaika_peer *peer, struct sLaika_contentContext *context, struct sLaika_content *content);
typedef void (*contentErrorEvent)(struct sLaika_peer *peer, struct sLaika_contentContext *context, struct sLaika_content *content, CONTENT_ERRCODE err);
struct sLaika_content {
struct sLaika_content *next;
FILE *fd;
uint32_t sz; /* content size */
uint32_t processed;
CONTENT_ID id;
CONTENT_TYPE type;
bool direction;
};
struct sLaika_contentContext {
struct sLaika_content *head;
CONTENT_ID nextID;
contentRecvEvent onReceived;
contentNewEvent onNew;
contentErrorEvent onError;
};
void laikaF_initContext(struct sLaika_contentContext *context);
void laikaF_cleanContext(struct sLaika_contentContext *context);
void laikaF_setupEvents(struct sLaika_contentContext *context, contentRecvEvent onRecv, contentNewEvent onNew, contentErrorEvent onError);
int laikaF_nextID(struct sLaika_peer *peer); /* returns the id that will be assigned to the next sent content */
int laikaF_sendContent(struct sLaika_peer *peer, FILE *fd, CONTENT_TYPE type);
void laikaF_pollContent(struct sLaika_peer *peer);
void laikaF_handleContentNew(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData);
void laikaF_handleContentError(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData);
void laikaF_handleContentChunk(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData);
#endif

View File

@@ -73,22 +73,6 @@ enum {
* uint32_t id;
* char buf[VAR_PACKET_LENGTH-sizeof(uint32_t)];
*/
LAIKAPKT_CONTENT_NEW,
/* layout of LAIKAPKT_CONTENT_NEW:
* uint16_t id;
* uint32_t sz;
* uint8_t type;
*/
LAIKAPKT_CONTENT_ERROR,
/* layout of LAIKAPKT_CONTENT_ERROR:
* uint16_t id;
* uint8_t errCode;
*/
LAIKAPKT_CONTENT_CHUNK, /* variadic */
/* layout of LAIKAPKT_CONTENT_CHUNK:
* uint16_t id;
* uint8_t buf[VAR_PACKET_LENGTH-sizeof(uint16_t)];
*/
/* ==================================================[[ Auth ]]================================================== */
LAIKAPKT_AUTHENTICATED_HANDSHAKE_REQ, /* second packet sent by authenticated peers (panel). there is no response packet */
/* layout of LAIKAPKT_STAGE2_HANDSHAKE_REQ

View File

@@ -6,7 +6,6 @@
#include "lpacket.h"
#include "lpolllist.h"
#include "lsodium.h"
#include "lcontent.h"
typedef enum {
PEER_UNKNWN,
@@ -43,7 +42,6 @@ struct sLaika_peerPacketInfo {
struct sLaika_peer {
struct sLaika_socket sock; /* DO NOT MOVE THIS. this member HAS TO BE FIRST so that typecasting sLaika_peer* to sLaika_sock* works as intended */
struct sLaika_contentContext context;
uint8_t peerPub[crypto_kx_PUBLICKEYBYTES]; /* connected peer's public key */
uint8_t inKey[crypto_kx_SESSIONKEYBYTES], outKey[crypto_kx_SESSIONKEYBYTES];
char hostname[LAIKA_HOSTNAME_LEN], inet[LAIKA_INET_LEN], ipStr[LAIKA_IPSTR_LEN];