mirror of https://github.com/GOSTSec/sgminer
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
#ifndef __UTIL_H__ |
|
#define __UTIL_H__ |
|
|
|
#if defined(unix) || defined(__APPLE__) |
|
#include <errno.h> |
|
#include <sys/socket.h> |
|
#include <netinet/in.h> |
|
#include <arpa/inet.h> |
|
|
|
#define SOCKETTYPE long |
|
#define SOCKETFAIL(a) ((a) < 0) |
|
#define INVSOCK -1 |
|
#define INVINETADDR -1 |
|
#define CLOSESOCKET close |
|
|
|
#define SOCKERRMSG strerror(errno) |
|
#elif defined WIN32 |
|
#include <ws2tcpip.h> |
|
#include <winsock2.h> |
|
|
|
#define SOCKETTYPE SOCKET |
|
#define SOCKETFAIL(a) ((int)(a) == SOCKET_ERROR) |
|
#define INVSOCK INVALID_SOCKET |
|
#define INVINETADDR INADDR_NONE |
|
#define CLOSESOCKET closesocket |
|
|
|
extern char *WSAErrorMsg(void); |
|
#define SOCKERRMSG WSAErrorMsg() |
|
|
|
#ifndef SHUT_RDWR |
|
#define SHUT_RDWR SD_BOTH |
|
#endif |
|
|
|
#ifndef in_addr_t |
|
#define in_addr_t uint32_t |
|
#endif |
|
#endif |
|
|
|
#if JANSSON_MAJOR_VERSION >= 2 |
|
#define JSON_LOADS(str, err_ptr) json_loads((str), 0, (err_ptr)) |
|
#else |
|
#define JSON_LOADS(str, err_ptr) json_loads((str), (err_ptr)) |
|
#endif |
|
|
|
struct pool; |
|
enum dev_reason; |
|
struct cgpu_info; |
|
bool stratum_send(struct pool *pool, char *s, ssize_t len); |
|
char *recv_line(struct pool *pool); |
|
bool parse_method(struct pool *pool, char *s); |
|
bool extract_sockaddr(struct pool *pool, char *url); |
|
bool auth_stratum(struct pool *pool); |
|
bool initiate_stratum(struct pool *pool); |
|
void dev_error(struct cgpu_info *dev, enum dev_reason reason); |
|
void *calloc_str(char *s); |
|
void *realloc_strcat(char *ptr, char *s); |
|
|
|
#endif /* __UTIL_H__ */
|
|
|