1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
/*
* Copyright 2014 Zvi (Zvisha) Shteingart - Spondoolies-tech.com
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version. See COPYING for more details.
*/
/*
This file holds functions needed for minergate packet parsing/creation
*/
#include "mg_proto_parser_sp30.h"
#include "assert.h"
//#include "spond_debug.h"
#ifndef passert
#define passert assert
#endif
minergate_req_packet_sp30 *allocate_minergate_packet_req_sp30(uint8_t requester_id,
uint8_t request_id) {
minergate_req_packet_sp30 *p =
(minergate_req_packet_sp30 *)malloc(sizeof(minergate_req_packet_sp30));
p->requester_id = requester_id;
p->req_count = 0;
p->protocol_version = MINERGATE_PROTOCOL_VERSION_SP30;
p->request_id = request_id;
p->magic = 0xcaf4;
p->mask = 0;
return p;
}
minergate_rsp_packet_sp30 *allocate_minergate_packet_rsp_sp30(uint8_t requester_id,
uint8_t request_id) {
minergate_rsp_packet_sp30 *p =
(minergate_rsp_packet_sp30 *)malloc(sizeof(minergate_rsp_packet_sp30));
p->requester_id = requester_id;
p->rsp_count = 0;
p->protocol_version = MINERGATE_PROTOCOL_VERSION_SP30;
p->request_id = request_id;
p->magic = 0xcaf4;
p->gh_div_10_rate= 0;
return p;
}