<commit_before>/// @file	rm_do_msg.h
/// @brief	Execute TCP messages.
/// @author	peterg
/// @version	0.1.1
/// @date	02 Nov 2016 04:29 PM
/// @copyright	LGPLv2.1


#ifndef RSYNCME_DO_MSG_H
#define RSYNCME_DO_MSG_H


#include "rm_defs.h"
#include "rm_session.h"

struct rm_msg_hdr
{
	uint32_t	hash;                           // security token
	uint8_t		pt;                             // payload type
	uint8_t		x;                              // unused yet
	uint8_t		y;                              // unused yet
	uint8_t		z;                              // unused yet
};

struct rm_msg_push
{
        struct rm_msg_hdr	hdr;			// header
        uint32_t		L;			// block size	
};

struct rm_msg_pull
{
        struct rm_msg_hdr	hdr;			// header
        uint32_t		L;			// block size
	uint32_t		ch_ch_n;		// number of elements in the ch_ch list,
							// that follows this msg, ch_ch elements
							// are being sent in chunks while computing
							// hashes on file
};

struct rsyncme;

/// @brief	Handles incoming rsync push request in new sesion.
/// @details	Daemon's message.
int
rm_do_msg_push_in(struct rsyncme* rm,
		unsigned char *buf);

/// @brief	Makes outgoing rsync push request.
/// @details	rsyncme program message.
int
rm_do_msg_push_out(struct rsyncme* rm,
		unsigned char *buf);

/// @brief	Handles incoming rsync pull request in new sesion.
/// @details	Daemon's message.
int
rm_do_msg_pull_in(struct rsyncme* rm,<commit_msg>rm_msg_push params<commit_after>/// @file	rm_do_msg.h
/// @brief	Execute TCP messages.
/// @author	peterg
/// @version	0.1.1
/// @date	02 Nov 2016 04:29 PM
/// @copyright	LGPLv2.1


#ifndef RSYNCME_DO_MSG_H
#define RSYNCME_DO_MSG_H


#include "rm_defs.h"
#include "rm_session.h"

struct rm_msg_hdr
{
	uint32_t	hash;                           // security token
	uint8_t		pt;                             // payload type
	uint8_t		x;                              // unused yet
	uint8_t		y;                              // unused yet
	uint8_t		z;                              // unused yet
};

struct rm_msg_push
{
        struct rm_msg_hdr	hdr;			// header
        uint32_t		L;			// block size
	uint16_t		x_name_len;		// x file name length
	char			x_name[];		// x file name	
	uint16_t		y_name_len;		// y file name length
	char			y_name[];		// y file name
	uint32_t		ip;			// IPv4	
};

struct rm_msg_pull
{
        struct rm_msg_hdr	hdr;			// header
        uint32_t		L;			// block size
	uint32_t		ch_ch_n;		// number of elements in the ch_ch list,
							// that follows this msg, ch_ch elements
							// are being sent in chunks while computing
							// hashes on file
};

struct rsyncme;

/// @brief	Handles incoming rsync push request in new sesion.
/// @details	Daemon's message.
int
rm_do_msg_push_in(struct rsyncme* rm,
		unsigned char *buf);

/// @brief	Makes outgoing rsync push request.
/// @details	rsyncme program message.
int
rm_do_msg_push_out(struct rsyncme* rm,
		unsigned char *buf);

/// @brief	Handles incoming rsync pull request in new sesion.
/// @details	Daemon's message.
int
rm_do_msg_pull_in(struct rsyncme* rm,
{'fraction_non_alphanumeric': 0.09587260318492037, 'fraction_numerical': 0.019824504387390314, 'mean_word_length': 1.9912536443148687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3055720', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1105, 'n_words': 321}