Skip to content

Commit 6663eb1

Browse files
author
Brian Olsen
committed
introduce TSStrategy type for plugins
1 parent 75510dd commit 6663eb1

15 files changed

+40
-41
lines changed

doc/developer-guide/api/functions/TSHttpTxnNextHopStrategyFind.en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Synopsis
2828
2929
#include <ts/ts.h>
3030
31-
.. function:: void const* TSHttpTxnNextHopStrategyFind(TSHttpTxn txnp, const char *name)
31+
.. function:: TSStrategy TSHttpTxnNextHopStrategyFind(TSHttpTxn txnp, const char *name)
3232

3333
Description
3434
===========

doc/developer-guide/api/functions/TSHttpTxnNextHopStrategyGet.en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Synopsis
2828
2929
#include <ts/ts.h>
3030
31-
.. function:: void const* TSHttpTxnNextHopStrategyGet(TSHttpTxn txnp)
31+
.. function:: TSStrategy TSHttpTxnNextHopStrategyGet(TSHttpTxn txnp)
3232

3333
Description
3434
===========

doc/developer-guide/api/functions/TSHttpTxnNextHopStrategySet.en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Synopsis
2828
2929
#include <ts/ts.h>
3030
31-
.. function:: void TSHttpTxnNextHopStrategySet(TSHttpTxn txnp, void const* strategy)
31+
.. function:: void TSHttpTxnNextHopStrategySet(TSHttpTxn txnp, TSStrategy strategy)
3232

3333
Description
3434
===========

doc/developer-guide/api/functions/TSNextHopStrategyNameGet.en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Synopsis
2828
2929
#include <ts/ts.h>
3030
31-
.. function:: char const* TSNextHopStrategyNameGet(void const* strategy)
31+
.. function:: char const* TSNextHopStrategyNameGet(TSStrategy strategy)
3232

3333
Description
3434
===========

doc/developer-guide/api/functions/TSRemapNextHopStrategyFind.en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Synopsis
2828
2929
#include <ts/ts.h>
3030
31-
.. function:: void const* TSRemapNextHopStrategyFind(const char *name)
31+
.. function:: TSStrategy TSRemapNextHopStrategyFind(const char *name)
3232

3333
Description
3434
===========

doc/developer-guide/api/functions/TSRemapNextHopStrategyGet.en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Synopsis
2828
2929
#include <ts/ts.h>
3030
31-
.. function:: void const* TSRemapNextHopStrategyGet()
31+
.. function:: TSStrategy TSRemapNextHopStrategyGet()
3232

3333
Description
3434
===========

doc/developer-guide/api/functions/TSRemapNextHopStrategySet.en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Synopsis
2828
2929
#include <ts/ts.h>
3030
31-
.. function:: void TSRemapNextHopStrategySet(void const* strategy)
31+
.. function:: void TSRemapNextHopStrategySet(TSStrategy strategy)
3232

3333
Description
3434
===========

include/ts/apidefs.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ using TSHostLookupResult = struct tsapi_hostlookupresult *;
10801080
using TSAIOCallback = struct tsapi_aiocallback *;
10811081
using TSAcceptor = struct tsapi_net_accept *;
10821082
using TSRemapPluginInfo = struct tsapi_remap_plugin_info *;
1083+
using TSStrategy = struct tsapi_strategy *;
10831084

10841085
using TSFetchSM = struct tsapi_fetchsm *;
10851086

include/ts/ts.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ char *TSHttpTxnErrorBodyGet(TSHttpTxn txnp, size_t *buflength, char **mimetype);
15901590
@param name of the strategy to look up.
15911591
15921592
*/
1593-
void const *TSHttpTxnNextHopStrategyFind(TSHttpTxn txnp, const char *name);
1593+
TSStrategy TSHttpTxnNextHopStrategyFind(TSHttpTxn txnp, const char *name);
15941594

15951595
/**
15961596
Sets the Transaction's Next Hop Parent Strategy.
@@ -1602,7 +1602,7 @@ void const *TSHttpTxnNextHopStrategyFind(TSHttpTxn txnp, const char *name);
16021602
@param pointer to the given strategy.
16031603
16041604
*/
1605-
void TSHttpTxnNextHopStrategySet(TSHttpTxn txnp, void const *strategy);
1605+
void TSHttpTxnNextHopStrategySet(TSHttpTxn txnp, TSStrategy strategy);
16061606

16071607
/**
16081608
Retrieves a pointer to the current next hop selection strategy.
@@ -1613,7 +1613,7 @@ void TSHttpTxnNextHopStrategySet(TSHttpTxn txnp, void const *strategy);
16131613
@param txnp HTTP transaction whose next hop strategy to get.
16141614
16151615
*/
1616-
void const *TSHttpTxnNextHopStrategyGet(TSHttpTxn txnp);
1616+
TSStrategy TSHttpTxnNextHopStrategyGet(TSHttpTxn txnp);
16171617

16181618
/**
16191619
Returns either null pointer or null terminated pointer to name.
@@ -1626,7 +1626,7 @@ void const *TSHttpTxnNextHopStrategyGet(TSHttpTxn txnp);
16261626
@param pointer to the NextHopStrategy.
16271627
16281628
*/
1629-
char const *TSNextHopStrategyNameGet(void const *strategy);
1629+
char const *TSNextHopStrategyNameGet(TSStrategy strategy);
16301630

16311631
/**
16321632
Retrieves a pointer to the named strategy in the strategy table.
@@ -1639,7 +1639,7 @@ char const *TSNextHopStrategyNameGet(void const *strategy);
16391639
@param name of the strategy to look up.
16401640
16411641
*/
1642-
void const *TSRemapNextHopStrategyFind(const char *name);
1642+
TSStrategy TSRemapNextHopStrategyFind(const char *name);
16431643

16441644
/**
16451645
Retrieves a pointer to remap rule strategy pointer.
@@ -1649,7 +1649,7 @@ void const *TSRemapNextHopStrategyFind(const char *name);
16491649
Returns nullptr if no strategy assigned.
16501650
16511651
*/
1652-
void const *TSRemapNextHopStrategyGet();
1652+
TSStrategy TSRemapNextHopStrategyGet();
16531653

16541654
/**
16551655
Sets the remap rule's next hop strategy.
@@ -1661,7 +1661,7 @@ void const *TSRemapNextHopStrategyGet();
16611661
@param handle to the strategy to set.
16621662
16631663
*/
1664-
void TSRemapNextHopStrategySet(void const *strategy);
1664+
void TSRemapNextHopStrategySet(TSStrategy strategy);
16651665

16661666
/**
16671667
Sets the parent proxy name and port. The string hostname is copied

plugins/header_rewrite/conditions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ ConditionNextHop::append_value(std::string &s, const Resources &res)
15391539
s.append(std::to_string(port));
15401540
} break;
15411541
case NEXT_HOP_STRATEGY: {
1542-
void const *const strategy = TSHttpTxnNextHopStrategyGet(res.state.txnp);
1542+
TSStrategy const strategy = TSHttpTxnNextHopStrategyGet(res.state.txnp);
15431543
if (nullptr != strategy) {
15441544
char const *const name = TSNextHopStrategyNameGet(strategy);
15451545
Dbg(pi_dbg_ctl, "Appending '%s' to evaluation value", name);

0 commit comments

Comments
 (0)