Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-tidy-ci
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Checks: >-
bugprone-unique-ptr-array-mismatch,
bugprone-unused-raii,
bugprone-use-after-move,
modernize-use-using,
performance-faster-string-find,
performance-inefficient-algorithm,
performance-inefficient-vector-operation,
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/eventsystem/VConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ enum TSApiDataType {
TS_API_DATA_LAST ///< Used by other classes to extend the enum values.
};

typedef struct tsapi_vio *TSVIO;
using TSVIO = struct tsapi_vio *;

/**
Base class for the connection classes that provide IO capabilities.
Expand Down
4 changes: 2 additions & 2 deletions include/iocore/net/NetVConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
#define SSL_EVENT_CLIENT 1

// Indicator the context for a NetVConnection
typedef enum {
enum NetVConnectionContext_t {
NET_VCONNECTION_UNSET = 0,
NET_VCONNECTION_IN, // Client <--> ATS, Client-Side
NET_VCONNECTION_OUT, // ATS <--> Server, Server-Side
} NetVConnectionContext_t;
};

/**
A VConnection for a network socket. Abstraction for a net connection.
Expand Down
12 changes: 6 additions & 6 deletions include/iocore/net/SessionSharingAPIEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#pragma once

/// Server session sharing values - match
typedef enum {
enum TSServerSessionSharingMatchType {
TS_SERVER_SESSION_SHARING_MATCH_IP,
TS_SERVER_SESSION_SHARING_MATCH_HOSTONLY,
TS_SERVER_SESSION_SHARING_MATCH_HOSTSNISYNC,
Expand All @@ -39,21 +39,21 @@ typedef enum {
TS_SERVER_SESSION_SHARING_MATCH_NONE,
TS_SERVER_SESSION_SHARING_MATCH_BOTH,
TS_SERVER_SESSION_SHARING_MATCH_HOST,
} TSServerSessionSharingMatchType;
};

typedef enum {
enum TSServerSessionSharingMatchMask {
TS_SERVER_SESSION_SHARING_MATCH_MASK_NONE = 0,
TS_SERVER_SESSION_SHARING_MATCH_MASK_IP = 0x1,
TS_SERVER_SESSION_SHARING_MATCH_MASK_HOSTONLY = 0x2,
TS_SERVER_SESSION_SHARING_MATCH_MASK_HOSTSNISYNC = 0x4,
TS_SERVER_SESSION_SHARING_MATCH_MASK_SNI = 0x8,
TS_SERVER_SESSION_SHARING_MATCH_MASK_CERT = 0x10,
} TSServerSessionSharingMatchMask;
};

/// Server session sharing values - pool
typedef enum {
enum TSServerSessionSharingPoolType {
TS_SERVER_SESSION_SHARING_POOL_GLOBAL,
TS_SERVER_SESSION_SHARING_POOL_THREAD,
TS_SERVER_SESSION_SHARING_POOL_HYBRID,
TS_SERVER_SESSION_SHARING_POOL_GLOBAL_LOCKED,
} TSServerSessionSharingPoolType;
};
4 changes: 2 additions & 2 deletions include/tscore/ink_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ union head_p {
typedef int32_t version_type;
typedef int64_t data_type;
#elif TS_HAS_128BIT_CAS
typedef int64_t version_type;
typedef __int128_t data_type;
using version_type = int64_t;
using data_type = __int128_t;
#else
using version_type = int64_t;
using data_type = int64_t;
Expand Down
10 changes: 5 additions & 5 deletions plugins/healthchecks/healthchecks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ static DbgCtl dbg_ctl{PLUGIN_NAME};
#define MAX_BODY_LEN 16384

/* Directories that we are watching for inotify IN_CREATE events. */
typedef struct HCDirEntry_t {
char dname[MAX_PATH_LEN]; /* Directory name */
int wd; /* Watch descriptor */
struct HCDirEntry_t *_next; /* Linked list */
} HCDirEntry;
struct HCDirEntry {
char dname[MAX_PATH_LEN]; /* Directory name */
int wd; /* Watch descriptor */
HCDirEntry *_next; /* Linked list */
};

/* Information about a status file. This is never modified (only replaced, see HCFileInfo) */
struct HCFileData {
Expand Down
4 changes: 2 additions & 2 deletions plugins/libloader/libloader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
#include <stdlib.h>
#include <ts/ts.h>

typedef struct link_handle_s {
using link_handle = struct link_handle_s {
void *handle;
link_handle_s *next;
} link_handle;
};

static link_handle *libs = nullptr;

Expand Down
5 changes: 2 additions & 3 deletions plugins/lua/ts_lua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ static char const *const ts_lua_g_stat_strs[] = {
nullptr,
};

typedef struct {
struct ts_lua_plugin_stats {
ts_lua_main_ctx *main_ctx_array;

TSMgmtInt gc_kb; // last collected gc in kb
TSMgmtInt threads; // last collected number active threads

int stat_inds[TS_LUA_IND_SIZE]; // stats indices

} ts_lua_plugin_stats;
};

ts_lua_plugin_stats *
create_plugin_stats(ts_lua_main_ctx *const main_ctx_array, char const *const *stat_strs)
Expand Down
4 changes: 2 additions & 2 deletions plugins/lua/ts_lua_client_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
#include "ts_lua_util.h"
#include "ts_lua_client_cert_helpers.h"

typedef enum {
enum TSLuaPPInfoKey {
TS_LUA_PP_INFO_VERSION = TS_PP_INFO_VERSION,
TS_LUA_PP_INFO_SRC_ADDR = TS_PP_INFO_SRC_ADDR,
TS_LUA_PP_INFO_SRC_PORT = TS_PP_INFO_SRC_PORT,
TS_LUA_PP_INFO_DST_ADDR = TS_PP_INFO_DST_ADDR,
TS_LUA_PP_INFO_DST_PORT = TS_PP_INFO_DST_PORT,
TS_LUA_PP_INFO_PROTOCOL = TS_PP_INFO_PROTOCOL,
TS_LUA_PP_INFO_SOCK_TYPE = TS_PP_INFO_SOCK_TYPE
} TSLuaPPInfoKey;
};

ts_lua_var_item ts_lua_pp_info_key_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_PP_INFO_VERSION), TS_LUA_MAKE_VAR_ITEM(TS_LUA_PP_INFO_SRC_ADDR),
Expand Down
31 changes: 14 additions & 17 deletions plugins/lua/ts_lua_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ extern "C" {
}

/* for http config or cntl var */
typedef struct {
struct ts_lua_var_item {
int nvar;
char const *svar;
} ts_lua_var_item;
};

typedef struct {
struct ts_lua_instance_conf {
char const *content;
char script[TS_LUA_MAX_SCRIPT_FNAME_LENGTH];
void *conf_vars[TS_LUA_MAX_CONFIG_VARS_COUNT];
Expand All @@ -107,10 +107,10 @@ typedef struct {
int ref_count;

int init_func;
} ts_lua_instance_conf;
};

/* lua state for vconn */
typedef struct {
struct ts_lua_vconn_ctx {
int ref;

ts_lua_main_ctx *mctx;
Expand All @@ -120,11 +120,10 @@ typedef struct {
TSVConn vconn;

ts_lua_instance_conf *instance_conf;

} ts_lua_vconn_ctx;
};

/* lua state for http request */
typedef struct {
struct ts_lua_http_ctx {
ts_lua_cont_info cinfo;

TSHttpTxn txnp;
Expand All @@ -151,16 +150,15 @@ typedef struct {
int from_remap;

TSRemapRequestInfo *rri;
};

} ts_lua_http_ctx;

typedef struct {
struct ts_lua_io_handle {
TSVIO vio;
TSIOBuffer buffer;
TSIOBufferReader reader;
} ts_lua_io_handle;
};

typedef struct {
struct ts_lua_http_transform_ctx {
ts_lua_cont_info cinfo;

ts_lua_io_handle output;
Expand All @@ -171,10 +169,9 @@ typedef struct {
int64_t upstream_watermark_bytes;
int64_t downstream_bytes;
int64_t total;
};

} ts_lua_http_transform_ctx;

typedef struct {
struct ts_lua_http_intercept_ctx {
ts_lua_cont_info cinfo;

ts_lua_io_handle input;
Expand All @@ -188,7 +185,7 @@ typedef struct {
unsigned int recv_complete : 1;
unsigned int send_complete : 1;
unsigned int all_ready : 1;
} ts_lua_http_intercept_ctx;
};

#define TS_LUA_RELEASE_IO_HANDLE(ih) \
do { \
Expand Down
22 changes: 11 additions & 11 deletions plugins/lua/ts_lua_coroutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,42 @@ extern "C" {
#include <ts/ts.h>

struct async_item;
typedef int (*async_clean)(struct async_item *item);
using async_clean = int (*)(struct async_item *item);

/* context stats */
typedef struct {
struct ts_lua_ctx_stats {
TSMutex mutexp; // mutex for the following stats
int gc_kb; // last recorded gc kbytes
int gc_kb_max; // maximum recorded gc kbytes
int threads; // associated coroutines
int threads_max; // max coroutines
} ts_lua_ctx_stats;
};

/* main context*/
typedef struct {
struct ts_lua_main_ctx {
lua_State *lua; // basic lua vm, injected
TSMutex mutexp; // mutex for lua vm
int gref; // reference for lua vm self, in reg table
ts_lua_ctx_stats *stats; // per vm stats
} ts_lua_main_ctx;
};

/* coroutine */
typedef struct {
struct ts_lua_coroutine {
ts_lua_main_ctx *mctx;
lua_State *lua; // derived lua_thread
int ref; // reference for lua_thread, in REG Table
} ts_lua_coroutine;
};

/* continuation info */
typedef struct {
struct ts_lua_cont_info {
ts_lua_coroutine routine;
TSCont contp; // continuation for the routine
TSMutex mutex; // mutex for continuation
struct async_item *async_chain; // async_item list
} ts_lua_cont_info;
};

/* asynchronous item */
typedef struct async_item {
using ts_lua_async_item = struct async_item {
struct async_item *next;
ts_lua_cont_info *cinfo;

Expand All @@ -73,7 +73,7 @@ typedef struct async_item {

async_clean cleanup; // cleanup function
unsigned int deleted : 1;
} ts_lua_async_item;
};

ts_lua_async_item *ts_lua_async_create_item(TSCont cont, async_clean func, void *d, ts_lua_cont_info *ci);
void ts_lua_release_cont_info(ts_lua_cont_info *ci);
8 changes: 4 additions & 4 deletions plugins/lua/ts_lua_fetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

struct fetch_multi_info;

typedef struct {
struct ts_lua_fetch_info {
TSCont contp;
struct fetch_multi_info *fmi;

Expand All @@ -32,14 +32,14 @@ typedef struct {

unsigned int over : 1;
unsigned int failed : 1;
} ts_lua_fetch_info;
};

typedef struct fetch_multi_info {
using ts_lua_fetch_multi_info = struct fetch_multi_info {
TSCont contp; // should be destroyed only in cleanup
int multi; // invoke from ts.fetch_multi
int total;
int done;
ts_lua_fetch_info fiv[0];
} ts_lua_fetch_multi_info;
};

void ts_lua_inject_fetch_api(lua_State *L);
4 changes: 2 additions & 2 deletions plugins/lua/ts_lua_hook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "ts_lua_transform.h"
#include "ts_lua_util.h"

typedef enum {
enum TSLuaHookID {
TS_LUA_HOOK_DUMMY = 0,
TS_LUA_HOOK_CACHE_LOOKUP_COMPLETE,
TS_LUA_HOOK_SEND_REQUEST_HDR,
Expand All @@ -39,7 +39,7 @@ typedef enum {
TS_LUA_RESPONSE_CLIENT,
TS_LUA_HOOK_VCONN_START,
TS_LUA_HOOK_LAST
} TSLuaHookID;
};

char const *ts_lua_hook_id_string[] = {"TS_LUA_HOOK_DUMMY",
"TS_LUA_HOOK_CACHE_LOOKUP_COMPLETE",
Expand Down
8 changes: 4 additions & 4 deletions plugins/lua/ts_lua_http.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
#include "ts_lua_http_milestone.h"
#include "ts_lua_http_txn_info.h"

typedef enum {
enum TSLuaCacheLookupResult {
TS_LUA_CACHE_LOOKUP_MISS,
TS_LUA_CACHE_LOOKUP_HIT_STALE,
TS_LUA_CACHE_LOOKUP_HIT_FRESH,
TS_LUA_CACHE_LOOKUP_SKIPPED,
} TSLuaCacheLookupResult;
};

typedef enum {
enum TSLuaServerState {
TS_LUA_SRVSTATE_STATE_UNDEFINED,
TS_LUA_SRVSTATE_ACTIVE_TIMEOUT,
TS_LUA_SRVSTATE_BAD_INCOMING_RESPONSE,
Expand All @@ -44,7 +44,7 @@ typedef enum {
TS_LUA_SRVSTATE_PARSE_ERROR,
TS_LUA_SRVSTATE_TRANSACTION_COMPLETE,
TS_LUA_SRVSTATE_PARENT_RETRY,
} TSLuaServerState;
};

const char *ts_lua_cache_lookup_result_string[] = {
"TS_LUA_CACHE_LOOKUP_MISS",
Expand Down
4 changes: 2 additions & 2 deletions plugins/lua/ts_lua_http_cntl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

#include "ts_lua_util.h"

typedef enum {
enum TSLuaHttpCntlType {
TS_LUA_HTTP_CNTL_LOGGING_MODE = TS_HTTP_CNTL_LOGGING_MODE,
TS_LUA_HTTP_CNTL_INTERCEPT_RETRY_MODE = TS_HTTP_CNTL_INTERCEPT_RETRY_MODE,
TS_LUA_HTTP_CNTL_RESPONSE_CACHEABLE = TS_HTTP_CNTL_RESPONSE_CACHEABLE,
TS_LUA_HTTP_CNTL_REQUEST_CACHEABLE = TS_HTTP_CNTL_REQUEST_CACHEABLE,
TS_LUA_HTTP_CNTL_SERVER_NO_STORE = TS_HTTP_CNTL_SERVER_NO_STORE,
TS_LUA_HTTP_CNTL_TXN_DEBUG = TS_HTTP_CNTL_TXN_DEBUG,
TS_LUA_HTTP_CNTL_SKIP_REMAPPING = TS_HTTP_CNTL_SKIP_REMAPPING
} TSLuaHttpCntlType;
};

ts_lua_var_item ts_lua_http_cntl_type_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_HTTP_CNTL_LOGGING_MODE), TS_LUA_MAKE_VAR_ITEM(TS_LUA_HTTP_CNTL_INTERCEPT_RETRY_MODE),
Expand Down
Loading