Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/typepayload #200

Merged
merged 19 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
command's payload creator
  • Loading branch information
angelskieglazki committed Mar 29, 2021
commit d4947b2b5e8aa0b28c392fef3614da810150d232
18 changes: 18 additions & 0 deletions src/commands_creator.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* \file commands_creator.c
* \author max
* Created on Mon Mar 29 17:14:47 2021
*/

#include "commands_creator.h"

typedef struct connect_r_packet {
uint32_t port;
char type[64];
uint8_t ip_counts;
char ips[];
} connect_r_packet_t;

uint8_t* createCmdConnectRPacketUdp(ksnetEvMgrClass *event_manager, size_t *size_out) {

}
17 changes: 17 additions & 0 deletions src/commands_creator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* \file commands_creator.h
* \author max
* Created on Mon Mar 29 17:14:47 2021
*/

#ifndef COMMANDS_CREATOR_H
#define COMMANDS_CREATOR_H

#include <stdint.h>
#include <stdlib.h>

#include "ev_mgr.h"

uint8_t* createCmdConnectRPacketUdp(ksnetEvMgrClass *event_manager, size_t *size_out);

#endif
7 changes: 6 additions & 1 deletion src/ev_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "utils/rlutil.h"
#include "modules/metric.h"

#include "commands_creator.h"

#define MODULE "event_manager"

// Global module variables
Expand Down Expand Up @@ -718,7 +720,8 @@ void connect_r_host_cb(ksnetEvMgrClass *ke) {
// check_connection_f = 0;

size_t ptr = 0;
void *data = NULL;
size_t packet_size = 0;
uint8_t *data = NULL;
ksnet_stringArr ips = NULL;

// Start TCP Proxy client connection if it is allowed and is not connected
Expand All @@ -734,6 +737,8 @@ void connect_r_host_cb(ksnetEvMgrClass *ke) {
ptr = sizeof(uint8_t); // Pointer (to first IP)
*num = 0; // Number of IPs
} else { // Create data for UDP connection

data = createCmdConnectRPacketUdp(ke, &packet_size);
// Create data with list of local IPs and port
ips = getIPs(&ke->teo_cfg); // IPs array
uint8_t len = ksnet_stringArrLength(ips); // Max number of IPs
Expand Down