SolidWallOfCode commented on a change in pull request #8066:
URL: https://github.com/apache/trafficserver/pull/8066#discussion_r673541060



##########
File path: include/ts/apidefs.h.in
##########
@@ -316,28 +432,52 @@ typedef enum {
     TS_HTTP_LAST_HOOK _must_ be the last element. Only right place
     to insert a new element is just before TS_HTTP_LAST_HOOK.
 
+
+    @note The TS_HTTP hooks below have to be in the same order as their
+    corresponding TS_EVENT counterparts.  We use this in calculating the
+    corresponding event from a hook ID by summing
+    TS_EVENT_HTTP_READ_REQUEST_HDR with the hook ID (see the invoke call in
+    HttpSM::state_api_callout). For example, the following expression must be
+    true:
+
+    TS_EVENT_HTTP_TXN_CLOSE == TS_EVENT_HTTP_READ_REQUEST_HDR + 
TS_HTTP_TXN_CLOSE_HOOK
+
  */
 typedef enum {
-  TS_HTTP_READ_REQUEST_HDR_HOOK,
-  TS_HTTP_OS_DNS_HOOK,
-  TS_HTTP_SEND_REQUEST_HDR_HOOK,
-  TS_HTTP_READ_CACHE_HDR_HOOK,
-  TS_HTTP_READ_RESPONSE_HDR_HOOK,
-  TS_HTTP_SEND_RESPONSE_HDR_HOOK,
-  TS_HTTP_REQUEST_TRANSFORM_HOOK,
-  TS_HTTP_RESPONSE_TRANSFORM_HOOK,
-  TS_HTTP_SELECT_ALT_HOOK,
-  TS_HTTP_TXN_START_HOOK,
-  TS_HTTP_TXN_CLOSE_HOOK,
-  TS_HTTP_SSN_START_HOOK,
-  TS_HTTP_SSN_CLOSE_HOOK,
-  TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK,
-  TS_HTTP_PRE_REMAP_HOOK,
-  TS_HTTP_POST_REMAP_HOOK,
-  TS_HTTP_RESPONSE_CLIENT_HOOK,
+/*
+   The following macro helps maintain the relationship between the TS_HTTP
+   hooks and their TS_EVENT_HTTP counterparts as described in the above
+   doxygen comment.
+ */
+#define REBASE(COMMON) TS_HTTP_##COMMON##_HOOK = TS_EVENT_HTTP_##COMMON - 
TS_EVENT_HTTP_READ_REQUEST_HDR

Review comment:
       That's a bad name - `REBASE`. Too much scope for conflict if another 
header file has it defined before including this one.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to