Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
- index 5e44982..77af3e8 100644
- --- a/proxy/InkAPI.cc
- +++ b/proxy/InkAPI.cc
- @@ -4016,25 +4016,25 @@ TSConfigDataGet(TSConfig configp)
- // Management
- //
- ////////////////////////////////////////////////////////////////////
- -int
- +TSReturnCode
- TSMgmtIntGet(const char *var_name, TSMgmtInt *result)
- {
- - return RecGetRecordInt((char *) var_name, (RecInt *) result) == REC_ERR_OKAY ? 1 : 0;
- + return RecGetRecordInt((char *) var_name, (RecInt *) result) == REC_ERR_OKAY ? TS_SUCCESS : TS_ERROR;
- }
- -int
- +TSReturnCode
- TSMgmtCounterGet(const char *var_name, TSMgmtCounter *result)
- {
- - return RecGetRecordCounter((char *) var_name, (RecCounter *) result) == REC_ERR_OKAY ? 1 : 0;
- + return RecGetRecordCounter((char *) var_name, (RecCounter *) result) == REC_ERR_OKAY ? TS_SUCCESS : TS_ERROR;
- }
- -int
- +TSReturnCode
- TSMgmtFloatGet(const char *var_name, TSMgmtFloat *result)
- {
- - return RecGetRecordFloat((char *) var_name, (RecFloat *) result) == REC_ERR_OKAY ? 1 : 0;
- + return RecGetRecordFloat((char *) var_name, (RecFloat *) result) == REC_ERR_OKAY ? TS_SUCCESS : TS_ERROR;
- }
- -int
- +TSReturnCode
- TSMgmtStringGet(const char *var_name, TSMgmtString *result)
- {
- RecString tmp = 0;
- @@ -4042,9 +4042,10 @@ TSMgmtStringGet(const char *var_name, TSMgmtString *result)
- if (tmp) {
- *result = tmp;
- - return 1;
- + return TS_SUCCESS;
- }
- - return 0;
- +
- + return TS_ERROR;
- }
- ////////////////////////////////////////////////////////////////////
- @@ -4332,7 +4333,7 @@ TSHttpTxnHookAdd(TSHttpTxn txnp, TSHttpHookID id, TSCont contp)
- // Private api function for gzip plugin.
- // This function should only appear in TsapiPrivate.h
- -int
- +TSReturnCode
- TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc funcp)
- {
- HttpSM *sm = (HttpSM *) txnp;
- @@ -4340,12 +4341,12 @@ TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc funcp)
- while (hook != NULL) {
- if (hook->m_cont && hook->m_cont->m_event_func == funcp) {
- - return 1;
- + return TS_SUCCESS;
- }
- hook = hook->m_link.next;
- }
- - return 0;
- + return TS_ERROR;
- }
- TSHttpSsn
- @@ -5393,7 +5394,7 @@ TSHttpTxnSetHttpRetBody(TSHttpTxn txnp, const char *body_msg, int plain_msg_flag
- }
- /* control channel for HTTP */
- -int
- +TSReturnCode
- TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data)
- {
- sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
- @@ -5403,9 +5404,8 @@ TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data)
- switch (cntl) {
- case TS_HTTP_CNTL_GET_LOGGING_MODE:
- {
- - if (data == NULL) {
- - return 0;
- - }
- + if (data == NULL)
- + return TS_ERROR;
- intptr_t *rptr = (intptr_t *) data;
- @@ -5415,23 +5415,22 @@ TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data)
- *rptr = (intptr_t) TS_HTTP_CNTL_OFF;
- }
- - return 1;
- + return TS_SUCCESS;
- }
- case TS_HTTP_CNTL_SET_LOGGING_MODE:
- if (data != TS_HTTP_CNTL_ON && data != TS_HTTP_CNTL_OFF) {
- - return 0;
- + return TS_ERROR;
- } else {
- sm->t_state.api_info.logging_enabled = (bool) data;
- - return 1;
- + return TS_SUCCESS;
- }
- break;
- case TS_HTTP_CNTL_GET_INTERCEPT_RETRY_MODE:
- {
- - if (data == NULL) {
- - return 0;
- - }
- + if (data == NULL)
- + return TS_ERROR;
- intptr_t *rptr = (intptr_t *) data;
- @@ -5441,21 +5440,21 @@ TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data)
- *rptr = (intptr_t) TS_HTTP_CNTL_OFF;
- }
- - return 1;
- + return TS_SUCCESS;
- }
- case TS_HTTP_CNTL_SET_INTERCEPT_RETRY_MODE:
- if (data != TS_HTTP_CNTL_ON && data != TS_HTTP_CNTL_OFF) {
- - return 0;
- + return TS_ERROR;
- } else {
- sm->t_state.api_info.retry_intercept_failures = (bool) data;
- - return 1;
- + return TS_SUCCESS;
- }
- default:
- - return 0;
- + return TS_ERROR;
- }
- - return 0;
- + return TS_ERROR;
- }
- /* This is kinda horky, we have to use TSServerState instead of
- @@ -6647,27 +6646,27 @@ TSIPLookupMatch(TSIPLookup iplu, uint32_t addr, void **data)
- return (my_iplu ? my_iplu->Match((ip_addr_t) addr, data) : 0);
- }
- -int
- +TSReturnCode
- TSIPLookupMatchFirst(TSIPLookup iplu, uint32_t addr, TSIPLookupState iplus, void **data)
- {
- IpLookup *my_iplu = (IpLookup *) iplu;
- IpLookupState *my_iplus = (IpLookupState *) iplus;
- if (my_iplu && my_iplus && my_iplu->MatchFirst(addr, my_iplus, data))
- - return 1;
- + return TS_SUCCESS;
- - return 0;
- + return TS_ERROR;
- }
- -int
- +TSReturnCode
- TSIPLookupMatchNext(TSIPLookup iplu, TSIPLookupState iplus, void **data)
- {
- IpLookup *my_iplu = (IpLookup *) iplu;
- IpLookupState *my_iplus = (IpLookupState *) iplus;
- if (my_iplu && my_iplus && my_iplu->MatchNext(my_iplus, data))
- - return 1;
- + return TS_SUCCESS;
- - return 0;
- + return TS_ERROR;
- }
- void
- @@ -6744,7 +6743,7 @@ TSMgmtConfigIntSet(const char *var_name, TSMgmtInt value)
- char *buffer;
- // is this a valid integer?
- - if (!TSMgmtIntGet(var_name, &result))
- + if (TSMgmtIntGet(var_name, &result) != TS_SUCCESS)
- return TS_ERROR;
- // construct a buffer
- @@ -6991,7 +6990,7 @@ TSFetchUrl(const char* headers, int request_len, unsigned int ip, int port , TSC
- fetch_sm->httpConnect();
- }
- -int
- +TSReturnCode
- TSHttpIsInternalRequest(TSHttpTxn txnp)
- {
- sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
- @@ -7001,9 +7000,9 @@ TSHttpIsInternalRequest(TSHttpTxn txnp)
- NetVConnection *vc = cs->get_netvc();
- if (!cs || !vc)
- - return 0;
- + return TS_ERROR;
- - return vc->get_is_internal_request() ? 1 : 0;
- + return vc->get_is_internal_request() ? TS_SUCCESS : TS_ERROR;
- }
- diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
- index f777b53..7ecdee0 100644
- --- a/proxy/InkAPITest.cc
- +++ b/proxy/InkAPITest.cc
- @@ -2252,7 +2252,7 @@ checkHttpTxnClientIncomingPortGet(SocketTest * test, void *data)
- return TS_EVENT_CONTINUE;
- }
- - if (TSMgmtIntGet("proxy.config.http.server_port", &port_from_config_file) == 0) {
- + if (TSMgmtIntGet("proxy.config.http.server_port", &port_from_config_file) != TS_SUCCESS) {
- port_from_config_file = 8080;
- }
- @@ -5545,15 +5545,13 @@ REGRESSION_TEST(SDK_API_TSMgmtGet) (RegressionTest * test, int atype, int *pstat
- *pstatus = REGRESSION_TEST_INPROGRESS;
- - int retVal;
- int err = 0;
- TSMgmtCounter cvalue = 0;
- TSMgmtFloat fvalue = 0.0;
- TSMgmtInt ivalue = -1;
- TSMgmtString svalue = NULL;
- - retVal = TSMgmtCounterGet(CONFIG_PARAM_COUNTER_NAME, &cvalue);
- - if (retVal == 0) {
- + if (TS_SUCCESS != TSMgmtCounterGet(CONFIG_PARAM_COUNTER_NAME, &cvalue)) {
- SDK_RPRINT(test, "TSMgmtCounterGet", "TestCase1.1", TC_FAIL, "can not get value of param %s", CONFIG_PARAM_COUNTER_NAME);
- err = 1;
- } else if (cvalue != CONFIG_PARAM_COUNTER_VALUE) {
- @@ -5565,24 +5563,21 @@ REGRESSION_TEST(SDK_API_TSMgmtGet) (RegressionTest * test, int atype, int *pstat
- SDK_RPRINT(test, "TSMgmtCounterGet", "TestCase1.1", TC_PASS, "ok");
- }
- - retVal = TSMgmtFloatGet(CONFIG_PARAM_FLOAT_NAME, &fvalue);
- - if ((retVal == 0) || (fvalue != CONFIG_PARAM_FLOAT_VALUE)) {
- + if ((TS_SUCCESS != TSMgmtFloatGet(CONFIG_PARAM_FLOAT_NAME, &fvalue)) || (fvalue != CONFIG_PARAM_FLOAT_VALUE)) {
- SDK_RPRINT(test, "TSMgmtFloatGet", "TestCase2", TC_FAIL, "can not get value of param %s", CONFIG_PARAM_FLOAT_NAME);
- err = 1;
- } else {
- SDK_RPRINT(test, "TSMgmtFloatGet", "TestCase1.2", TC_PASS, "ok");
- }
- - retVal = TSMgmtIntGet(CONFIG_PARAM_INT_NAME, &ivalue);
- - if ((retVal == 0) || (ivalue != CONFIG_PARAM_INT_VALUE)) {
- + if ((TSMgmtIntGet(CONFIG_PARAM_INT_NAME, &ivalue) != TS_SUCCESS) || (ivalue != CONFIG_PARAM_INT_VALUE)) {
- SDK_RPRINT(test, "TSMgmtIntGet", "TestCase1.3", TC_FAIL, "can not get value of param %s", CONFIG_PARAM_INT_NAME);
- err = 1;
- } else {
- SDK_RPRINT(test, "TSMgmtIntGet", "TestCase1.3", TC_PASS, "ok");
- }
- - retVal = TSMgmtStringGet(CONFIG_PARAM_STRING_NAME, &svalue);
- - if (retVal == 0) {
- + if (TS_SUCCESS != TSMgmtStringGet(CONFIG_PARAM_STRING_NAME, &svalue)) {
- SDK_RPRINT(test, "TSMgmtStringGet", "TestCase1.4", TC_FAIL, "can not get value of param %s", CONFIG_PARAM_STRING_NAME);
- err = 1;
- } else if (strcmp(svalue, CONFIG_PARAM_STRING_VALUE) != 0) {
- diff --git a/proxy/InkAPITestTool.cc b/proxy/InkAPITestTool.cc
- index dfed535..754fa4b 100644
- --- a/proxy/InkAPITestTool.cc
- +++ b/proxy/InkAPITestTool.cc
- @@ -431,7 +431,7 @@ synclient_txn_create(void)
- TSMgmtInt proxy_port;
- ClientTxn *txn = (ClientTxn *) TSmalloc(sizeof(ClientTxn));
- - if (!TSMgmtIntGet(PROXY_CONFIG_NAME_HTTP_PORT, &proxy_port)) {
- + if (TSMgmtIntGet(PROXY_CONFIG_NAME_HTTP_PORT, &proxy_port) != TS_SUCCESS) {
- proxy_port = PROXY_HTTP_DEFAULT_PORT;
- }
- txn->connect_port = (int) proxy_port;
- diff --git a/proxy/api/ts/experimental.h b/proxy/api/ts/experimental.h
- index 6259d04..41e8c60 100644
- --- a/proxy/api/ts/experimental.h
- +++ b/proxy/api/ts/experimental.h
- @@ -51,7 +51,7 @@ extern "C"
- /* Do not edit these apis, used internally */
- tsapi int TSMimeHdrFieldEqual(TSMBuffer bufp, TSMLoc hdr_obj, TSMLoc field1, TSMLoc field2);
- - tsapi int TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc funcp);
- + tsapi TSReturnCode TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc funcp);
- /* IP Lookup */
- typedef void *TSIPLookup;
- @@ -61,8 +61,8 @@ extern "C"
- tsapi void TSIPLookupPrint(TSIPLookup iplu, TSIPLookupPrintFunc pf);
- tsapi void TSIPLookupNewEntry(TSIPLookup iplu, uint32_t addr1, uint32_t addr2, void *data);
- tsapi int TSIPLookupMatch(TSIPLookup iplu, uint32_t addr, void **data);
- - tsapi int TSIPLookupMatchFirst(TSIPLookup iplu, uint32_t addr, TSIPLookupState iplus, void **data);
- - tsapi int TSIPLookupMatchNext(TSIPLookup iplu, TSIPLookupState iplus, void **data);
- + tsapi TSReturnCode TSIPLookupMatchFirst(TSIPLookup iplu, uint32_t addr, TSIPLookupState iplus, void **data);
- + tsapi TSReturnCode TSIPLookupMatchNext(TSIPLookup iplu, TSIPLookupState iplus, void **data);
- /* for Media-IXT mms over http */
- typedef enum
- @@ -80,7 +80,7 @@ extern "C"
- TSHttpTxnCntl(.., TS_HTTP_CNTL_GET_LOGGING_MODE, &onoff);
- if (onoff == TS_HTTP_CNTL_ON) ....
- */
- - tsapi int TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data);
- + tsapi TSReturnCode TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data);
- /* Protocols APIs */
- diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
- index 9d1e269..9a5fb50 100644
- --- a/proxy/api/ts/ts.h.in
- +++ b/proxy/api/ts/ts.h.in
- @@ -2018,10 +2018,10 @@ extern "C"
- /* --------------------------------------------------------------------------
- Management */
- - tsapi int TSMgmtIntGet(const char *var_name, TSMgmtInt *result);
- - tsapi int TSMgmtCounterGet(const char *var_name, TSMgmtCounter *result);
- - tsapi int TSMgmtFloatGet(const char *var_name, TSMgmtFloat *result);
- - tsapi int TSMgmtStringGet(const char *var_name, TSMgmtString *result);
- + tsapi TSReturnCode TSMgmtIntGet(const char *var_name, TSMgmtInt *result);
- + tsapi TSReturnCode TSMgmtCounterGet(const char *var_name, TSMgmtCounter *result);
- + tsapi TSReturnCode TSMgmtFloatGet(const char *var_name, TSMgmtFloat *result);
- + tsapi TSReturnCode TSMgmtStringGet(const char *var_name, TSMgmtString *result);
- /* --------------------------------------------------------------------------
- Continuations */
- @@ -2267,7 +2267,7 @@ extern "C"
- tsapi void TSFetchPages(TSFetchUrlParams_t *params);
- /* Check if HTTP State machine is internal or not */
- - tsapi int TSHttpIsInternalRequest(TSHttpTxn txnp);
- + tsapi TSReturnCode TSHttpIsInternalRequest(TSHttpTxn txnp);
- /* --------------------------------------------------------------------------
- HTTP alternate selection */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement