home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / notify.h < prev    next >
C/C++ Source or Header  |  1997-10-25  |  3KB  |  111 lines

  1. #ifndef __NOTIFY_H__
  2. #define __NOTIFY_H__
  3.  
  4.  
  5. #define SZ_SESSION_ID_COOKIE_NAME      "ASPSESSIONID"
  6. #define SZ_SESSION_ID_COOKIE_NAME_SIZE 12 // strlen(SZ_SESSION_ID_COOKIE_NAME)
  7. #define MAX_SESSION_ID_SIZE 24
  8.  
  9. // the different types of munging available
  10. // off        -    no munging will be done
  11. // on        -    munging will always be done
  12. // smart    -    the munger will "test the waters" to see if cookies are getting through for each session.
  13. //                If they are, the munger will not be effectively off for this session.  Otherwise, cookies
  14. //                will be munged as usual.
  15. typedef enum
  16. {
  17.     MungeMode_Off=0,
  18.     MungeMode_On,
  19.     MungeMode_Smart
  20. } MungeModeT;
  21.  
  22. // the munging mode.  This will be read from the registry upon initialization
  23. extern int    g_mungeMode;
  24.  
  25. // the session ID size is either 16 or 24 characters (depending on the server version)
  26. extern long g_SessionIDSize;
  27.  
  28. extern CHAR g_szCookieExtra[];
  29.  
  30. // states for OnSendRawData
  31.  
  32. enum HN_STATE {
  33.     HN_UNDEFINED = 0,
  34.     HN_SEEN_URL,
  35.     HN_IN_HEADER,
  36.     HN_IN_BODY,
  37. };
  38.  
  39.  
  40. enum CONTENT_TYPE {
  41.     CT_UNDEFINED = 0,
  42.     CT_TEXT_HTML,
  43. };
  44.  
  45. class CNotification
  46. {
  47. public:
  48.     enum {SPARE_BYTES = 2};
  49.             
  50.     static
  51.     CNotification*
  52.     Create(
  53.         PHTTP_FILTER_CONTEXT pfc,
  54.         LPCSTR               pszCookie);
  55.         
  56.     static
  57.     void
  58.     Destroy(
  59.         PHTTP_FILTER_CONTEXT pfc);
  60.  
  61.     static
  62.     CNotification*
  63.     Get(
  64.         PHTTP_FILTER_CONTEXT pfc)
  65.     {return static_cast<CNotification*>(pfc->pFilterContext);}
  66.  
  67.     static
  68.     CNotification*
  69.     SetSessionID(
  70.         PHTTP_FILTER_CONTEXT pfc,
  71.         LPCSTR               pszCookie);
  72.     
  73.     LPCSTR
  74.     SessionID() const
  75.     {return m_szSessionID;}
  76.  
  77.     HN_STATE
  78.     State() const
  79.     {return m_nState;}
  80.  
  81.     void
  82.     AppendToken(
  83.         PHTTP_FILTER_CONTEXT pfc,
  84.         LPCSTR               pszNewData,
  85.         int                  cchNewData);
  86.  
  87.     bool MungingOff() const
  88.     {return ( !m_fEatCookies ) && ( !m_fTestCookies );}
  89.  
  90. protected:
  91.     CNotification(
  92.         LPCSTR pszCookie);
  93.  
  94.     ~CNotification();
  95.     
  96. public:
  97.     HN_STATE     m_nState;
  98.     CONTENT_TYPE m_ct;
  99.     CHAR         m_szSessionID[ MAX_SESSION_ID_SIZE ];
  100.     LPSTR        m_pszUrl;
  101.     LPBYTE       m_pbPartialToken;
  102.     int          m_cbPartialToken;
  103.     LPBYTE       m_pbTokenBuffer;
  104.     int          m_cbTokenBuffer;
  105.     DWORD        m_cchContentLength;
  106.     bool         m_fEatCookies;
  107.     bool         m_fTestCookies;
  108. };
  109.  
  110. #endif // __NOTIFY_H__
  111.