transportInt.h 1.9 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
#ifdef USE_UV
dengyihao's avatar
dengyihao 已提交
20
#include <uv.h>
dengyihao's avatar
dengyihao 已提交
21
#endif
dengyihao's avatar
dengyihao 已提交
22 23 24 25
#include "lz4.h"
#include "os.h"
#include "taoserror.h"
#include "thash.h"
dengyihao's avatar
dengyihao 已提交
26
#include "tref.h"
dengyihao's avatar
dengyihao 已提交
27
#include "tmsg.h"
dengyihao's avatar
dengyihao 已提交
28
#include "transLog.h"
dengyihao's avatar
dengyihao 已提交
29 30
#include "trpc.h"
#include "tutil.h"
dengyihao's avatar
dengyihao 已提交
31
#include "tglobal.h"
dengyihao's avatar
dengyihao 已提交
32

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

dengyihao's avatar
dengyihao 已提交
37 38
#ifdef USE_UV

dengyihao's avatar
dengyihao 已提交
39 40 41
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 已提交
42 43 44
void taosCloseServer(void* arg);
void taosCloseClient(void* arg);

dengyihao's avatar
dengyihao 已提交
45 46 47 48 49 50 51
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 已提交
52
  char     user[TSDB_UNI_LEN];  // meter ID
dengyihao's avatar
dengyihao 已提交
53 54

  void (*cfp)(void* parent, SRpcMsg*, SEpSet*);
dengyihao's avatar
dengyihao 已提交
55
  bool (*retry)(int32_t code);
dengyihao's avatar
dengyihao 已提交
56
  int index;
dengyihao's avatar
dengyihao 已提交
57

dengyihao's avatar
dengyihao 已提交
58 59 60
  int32_t       refCount;
  void*         parent;
  void*         tcphandle;  // returned handle from TCP initialization
wafwerar's avatar
wafwerar 已提交
61
  TdThreadMutex mutex;
dengyihao's avatar
dengyihao 已提交
62
} SRpcInfo;
dengyihao's avatar
dengyihao 已提交
63 64

#endif  // USE_LIBUV
dengyihao's avatar
dengyihao 已提交
65

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

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