Branch: Tag:

2006-04-20

2006-04-20 09:41:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added support for overriding the requestid variable.

Rev: server/etc/include/roxen.h:1.30

1:   // -*- pike -*-   // - // $Id: roxen.h,v 1.29 2004/04/21 16:08:41 mast Exp $ + // $Id: roxen.h,v 1.30 2006/04/20 09:41:42 grubba Exp $      #ifndef _ROXEN_H_   
9:   #define HOST_TO_IP 'H'   #define IP_TO_HOST 'I'    + #ifndef REQUESTID + #define REQUESTID id + #endif +    // Localization support      #ifndef __LOCALEOBJECT
45:   #endif      #ifdef DEBUG_CACHEABLE - # define CACHE(seconds) do { \ -  int old_cacheable = ([mapping(string:mixed)]id->misc)->cacheable; \ -  ([mapping(string:mixed)]id->misc)->cacheable = \ -  min(([mapping(string:mixed)]id->misc)->cacheable,seconds); \ -  report_debug("%s:%d lowered cacheable to %d (was: %d, now: %d)\n", \ -  __FILE__, __LINE__, seconds, old_cacheable, \ -  ([mapping(string:mixed)]id->misc)->cacheable); \ + # define CACHE(seconds) do { \ +  int old_cacheable = \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable; \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable = \ +  min(([mapping(string:mixed)]REQUESTID->misc)->cacheable,seconds); \ +  report_debug("%s:%d lowered cacheable to %d (was: %d, now: %d)\n", \ +  __FILE__, __LINE__, seconds, old_cacheable, \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable); \    } while(0) - # define RAISE_CACHE(seconds) do { \ -  int old_cacheable = ([mapping(string:mixed)]id->misc)->cacheable; \ -  ([mapping(string:mixed)]id->misc)->cacheable = \ -  max(([mapping(string:mixed)]id->misc)->cacheable,seconds); \ -  report_debug("%s:%d raised cacheable to %d (was: %d, now: %d)\n", \ -  __FILE__, __LINE__, seconds, old_cacheable, \ -  ([mapping(string:mixed)]id->misc)->cacheable); \ + # define RAISE_CACHE(seconds) do { \ +  int old_cacheable = \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable; \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable = \ +  max(([mapping(string:mixed)]REQUESTID->misc)->cacheable,seconds); \ +  report_debug("%s:%d raised cacheable to %d (was: %d, now: %d)\n", \ +  __FILE__, __LINE__, seconds, old_cacheable, \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable); \    } while(0) - # define NOCACHE() do { \ -  int old_cacheable = ([mapping(string:mixed)]id->misc)->cacheable; \ -  ([mapping(string:mixed)]id->misc)->cacheable = 0; \ -  report_debug("%s:%d set cacheable to 0 (was: %d)\n", \ -  __FILE__, __LINE__, old_cacheable, \ -  ([mapping(string:mixed)]id->misc)->cacheable); \ + # define NOCACHE() do { \ +  int old_cacheable = \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable; \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable = 0; \ +  report_debug("%s:%d set cacheable to 0 (was: %d)\n", \ +  __FILE__, __LINE__, old_cacheable, \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable); \    } while(0) - # define NO_PROTO_CACHE() do { \ -  ([mapping(string:mixed)]id->misc)->no_proto_cache = 1; \ -  report_debug("%s:%d disabled proto cache\n", __FILE__, __LINE__); \ + # define NO_PROTO_CACHE() do { \ +  ([mapping(string:mixed)]REQUESTID->misc)->no_proto_cache = 1; \ +  report_debug("%s:%d disabled proto cache\n", __FILE__, __LINE__); \    } while(0) - # define PROTO_CACHE() do { \ -  ([mapping(string:mixed)]id->misc)->no_proto_cache = 0; \ -  report_debug("%s:%d enabled proto cache\n", __FILE__, __LINE__); \ + # define PROTO_CACHE() do { \ +  ([mapping(string:mixed)]REQUESTID->misc)->no_proto_cache = 0; \ +  report_debug("%s:%d enabled proto cache\n", __FILE__, __LINE__); \    } while(0)   #else - # define CACHE(seconds) ([mapping(string:mixed)]id->misc)->cacheable=min(([mapping(string:mixed)]id->misc)->cacheable,seconds) - # define RAISE_CACHE(seconds) ([mapping(string:mixed)]id->misc)->cacheable=max(([mapping(string:mixed)]id->misc)->cacheable,seconds) - # define NOCACHE() ([mapping(string:mixed)]id->misc)->cacheable=0 - # define NO_PROTO_CACHE() ([mapping(string:mixed)]id->misc)->no_proto_cache=1 - # define PROTO_CACHE() ([mapping(string:mixed)]id->misc)->no_proto_cache=0 + # define CACHE(seconds) \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable = \ +  min(([mapping(string:mixed)]REQUESTID->misc)->cacheable,seconds) + # define RAISE_CACHE(seconds) \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable = \ +  max(([mapping(string:mixed)]REQUESTID->misc)->cacheable,seconds) + # define NOCACHE() \ +  ([mapping(string:mixed)]REQUESTID->misc)->cacheable=0 + # define NO_PROTO_CACHE() \ +  ([mapping(string:mixed)]REQUESTID->misc)->no_proto_cache = 1 + # define PROTO_CACHE() \ +  ([mapping(string:mixed)]REQUESTID->misc)->no_proto_cache = 0   #endif /* DEBUG_CACHEABLE */      #endif /* !_ROXEN_H_ */