transportInt.h 2.1 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

H
Hongze Cheng 已提交
16 17
#ifndef _TD_TRANSPORT_INT_H_
#define _TD_TRANSPORT_INT_H_
H
refact  
Hongze Cheng 已提交
18

dengyihao's avatar
dengyihao 已提交
19 20 21 22
#include <uv.h>
#include "lz4.h"
#include "os.h"
#include "taoserror.h"
dengyihao's avatar
dengyihao 已提交
23
#include "tglobal.h"
dengyihao's avatar
dengyihao 已提交
24 25
#include "thash.h"
#include "tmsg.h"
dengyihao's avatar
dengyihao 已提交
26
#include "transLog.h"
dengyihao's avatar
dengyihao 已提交
27
#include "tref.h"
dengyihao's avatar
dengyihao 已提交
28 29 30
#include "trpc.h"
#include "tutil.h"

H
refact  
Hongze Cheng 已提交
31 32 33 34
#ifdef __cplusplus
extern "C" {
#endif

dengyihao's avatar
dengyihao 已提交
35 36 37
void* taosInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
void* taosInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);

dengyihao's avatar
dengyihao 已提交
38 39 40
void taosCloseServer(void* arg);
void taosCloseClient(void* arg);

dengyihao's avatar
dengyihao 已提交
41 42 43 44 45 46 47
typedef struct {
  int      sessions;      // number of sessions allowed
  int      numOfThreads;  // number of threads to process incoming messages
  int      idleTime;      // milliseconds;
  uint16_t localPort;
  int8_t   connType;
  char     label[TSDB_LABEL_LEN];
dengyihao's avatar
dengyihao 已提交
48
  char     user[TSDB_UNI_LEN];  // meter ID
dengyihao's avatar
dengyihao 已提交
49

dengyihao's avatar
dengyihao 已提交
50 51 52 53
  int32_t compressSize;   // -1: no compress, 0 : all data compressed, size: compress data if larger than size
  int8_t  encryption;     // encrypt or not
  int32_t retryLimit;     // retry limit
  int32_t retryInterval;  // retry interval ms
dengyihao's avatar
dengyihao 已提交
54

dengyihao's avatar
dengyihao 已提交
55
  void (*cfp)(void* parent, SRpcMsg*, SEpSet*);
dengyihao's avatar
dengyihao 已提交
56
  bool (*retry)(int32_t code, tmsg_t msgType);
dengyihao's avatar
dengyihao 已提交
57
  bool (*startTimer)(int32_t code, tmsg_t msgType);
dengyihao's avatar
dengyihao 已提交
58
  void (*destroyFp)(void* ahandle);
dengyihao's avatar
dengyihao 已提交
59

dengyihao's avatar
dengyihao 已提交
60
  int           index;
dengyihao's avatar
dengyihao 已提交
61 62
  void*         parent;
  void*         tcphandle;  // returned handle from TCP initialization
dengyihao's avatar
dengyihao 已提交
63
  int64_t       refId;
wafwerar's avatar
wafwerar 已提交
64
  TdThreadMutex mutex;
dengyihao's avatar
dengyihao 已提交
65
} SRpcInfo;
dengyihao's avatar
dengyihao 已提交
66

H
refact  
Hongze Cheng 已提交
67 68 69 70
#ifdef __cplusplus
}
#endif

dengyihao's avatar
dengyihao 已提交
71
#endif /*_TD_TRANSPORT_INT_H_*/