You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/07/20 22:43:51 UTC

[GitHub] [trafficserver] SolidWallOfCode commented on a change in pull request #8066: Fixing TS_HTTP_REQUEST_BUFFER_READ_COMPLETE_HOOK enum value.

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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org