aboutsummaryrefslogtreecommitdiffstats
path: root/globals.h
blob: c9281663b3d8f19abec33e41f92346c3c0bf0916 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * Copyright (C) 2016 Intel Corporation
 *
 * Author: Todor Minchev <todor.minchev@linux.intel.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, or (at your option) any later version, as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef GLOBALS_H
#define GLOBALS_H
#ifdef __linux
#define _GNU_SOURCE
#endif


#include <math.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define KEY_ARR_SZ 'z' -'a' + 1
#define KEY(var) abs('a'- #var[1])


#define CODI_PORT      "10000"
#define CODI_IP_NATIVE "127.0.0.1"
#define CODI_IP_VIRT   "192.168.99.100"
#define TURFF_PORT     "9999"
#define MSG_TERM       "EOM"
#define VERSION        "0.1"
#define TURFF_EOM      "TEOM"
#define CEED_NAME      "ceed"
#define TURFF_NAME     "turff"
#define CODI_NAME      "codi"
#define TURFFID        "TURFFID"

void info(const char *file, int line, const char *func, const char* fmt, ...);
void debug(const char *file, int line, const char *func, const char* fmt, ...);
void error(const char *file, int line, const char *func, const char* fmt, ...);

#define INFO(...)  info(__FILE__, __LINE__, __func__, __VA_ARGS__)
#define ERR(...) error(__FILE__, __LINE__, __func__, __VA_ARGS__)
#define DEBUG(...) debug(__FILE__, __LINE__, __func__, __VA_ARGS__)

typedef enum { false, true } bool;

/* parameter chunk*/
typedef struct chunk{
  uint32_t op_code;
  char arg[20];
  struct chunk *next;
} msg_chunk;

typedef struct{
  char  *mem;
  size_t size;
} curl_mem_chunk_t;

#endif