transportInt.h 2.4 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
#include "lz4.h"
#include "os.h"
#include "rpcCache.h"
dengyihao's avatar
dengyihao 已提交
25
#include "rpcHead.h"
dengyihao's avatar
dengyihao 已提交
26 27 28 29 30 31 32 33 34 35 36
#include "rpcLog.h"
#include "taoserror.h"
#include "tglobal.h"
#include "thash.h"
#include "tidpool.h"
#include "tmsg.h"
#include "tref.h"
#include "trpc.h"
#include "ttimer.h"
#include "tutil.h"

H
refact  
Hongze Cheng 已提交
37 38 39 40
#ifdef __cplusplus
extern "C" {
#endif

dengyihao's avatar
dengyihao 已提交
41 42
#ifdef USE_UV

dengyihao's avatar
dengyihao 已提交
43 44 45
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 已提交
46 47 48
void taosCloseServer(void* arg);
void taosCloseClient(void* arg);

dengyihao's avatar
dengyihao 已提交
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
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;
  int64_t  index;
  char     label[TSDB_LABEL_LEN];

  char user[TSDB_UNI_LEN];         // meter ID
  char spi;                        // security parameter index
  char encrypt;                    // encrypt algorithm
  char secret[TSDB_PASSWORD_LEN];  // secret for the link
  char ckey[TSDB_PASSWORD_LEN];    // ciphering key

  void (*cfp)(void* parent, SRpcMsg*, SEpSet*);
  int (*afp)(void* parent, char* user, char* spi, char* encrypt, char* secret, char* ckey);
dengyihao's avatar
dengyihao 已提交
66
  int (*retry)(void* parent, SRpcMsg*, SEpSet*);
dengyihao's avatar
dengyihao 已提交
67

dengyihao's avatar
dengyihao 已提交
68 69 70 71 72 73
  int32_t       refCount;
  void*         parent;
  void*         idPool;     // handle to ID pool
  void*         tmrCtrl;    // handle to timer
  SHashObj*     hash;       // handle returned by hash utility
  void*         tcphandle;  // returned handle from TCP initialization
wafwerar's avatar
wafwerar 已提交
74
  TdThreadMutex mutex;
dengyihao's avatar
dengyihao 已提交
75
} SRpcInfo;
dengyihao's avatar
dengyihao 已提交
76 77

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

H
refact  
Hongze Cheng 已提交
79 80 81 82
#ifdef __cplusplus
}
#endif

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