Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.1 KiB

  1. /*----------------------------------------------------------------------------
  2. pbserver.h
  3. CPhoneBkServer class definition
  4. Copyright (c) 1997-1998 Microsoft Corporation
  5. All rights reserved.
  6. Authors:
  7. byao Baogang Yao
  8. History:
  9. 01/23/97 byao Created
  10. --------------------------------------------------------------------------*/
  11. #ifndef _PBSVR_INCL_
  12. #define _PBSVR_INCL_
  13. #define VERSION_LEN 64
  14. #include <windows.h>
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include <httpext.h>
  18. // HTTP status code -- copied from 'afxisapi.h'
  19. #define HTTP_STATUS_OK 200 // OK
  20. #define HTTP_STATUS_CREATED 201 // created
  21. #define HTTP_STATUS_ACCEPTED 202 // accepted
  22. #define HTTP_STATUS_NO_CONTENT 204 // no content
  23. #define HTTP_STATUS_REDIRECT 301 // moved permanently
  24. #define HTTP_STATUS_TEMP_REDIRECT 302 // moved temporarily
  25. #define HTTP_STATUS_NOT_MODIFIED 304 // not modified
  26. #define HTTP_STATUS_BAD_REQUEST 400 // bad request
  27. #define HTTP_STATUS_AUTH_REQUIRED 401 // unauthorized
  28. #define HTTP_STATUS_FORBIDDEN 403 // forbidden
  29. #define HTTP_STATUS_NOT_FOUND 404 // not found
  30. #define HTTP_STATUS_SERVICE_NA 405 // service unavailable
  31. #define HTTP_STATUS_SERVER_ERROR 500 // internal server error
  32. #define HTTP_STATUS_NOT_IMPLEMENTED 501 // not implemented
  33. #define HTTP_STATUS_BAD_GATEWAY 502 // bad gateway
  34. #define NAME_VALUE_LEN 128
  35. // If the query string is NULL, or there are invalid number of parameters in it,
  36. // then treat it as an 'INVALID_QUERY_STRING'
  37. #define INVALID_QUERY_STRING -1
  38. typedef struct {
  39. char m_achName[NAME_VALUE_LEN];
  40. char m_achVal[NAME_VALUE_LEN];
  41. } PARAMETER_PAIR, *LPPARAMETER_PAIR;
  42. // all numerical params must be <= "999999" (i.e. the strlen must be <= 6)
  43. #define MAX_LEN_FOR_NUMERICAL_VALUE 6
  44. // query parameter that will be passed from client to the ISA
  45. typedef struct _query_parameter {
  46. int m_dOSArch;
  47. int m_dOSType;
  48. int m_dLCID;
  49. char m_achOSVer[VERSION_LEN];
  50. char m_achCMVer[VERSION_LEN];
  51. char m_achPB[VERSION_LEN];
  52. int m_dPBVer;
  53. } QUERY_PARAMETER, *LPQUERY_PARAMETER;
  54. class CPhoneBkServer
  55. {
  56. private:
  57. BOOL m_bInitialized;
  58. public:
  59. BOOL GetExtensionVersion(LPHSE_VERSION_INFO pVer);
  60. DWORD HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpEcb);
  61. protected:
  62. BOOL GetQueryParameter(char *pszQuery, size_t cchQuery, LPQUERY_PARAMETER lpQueryParamter);
  63. void BuildStatusCode(LPTSTR pszResponse, UINT cchResponse, DWORD dwCode);
  64. DWORD GetFileLength(LPSTR lpszFileName);
  65. int GetParameterPairs(
  66. char *pszInputString,
  67. size_t cchInputString,
  68. LPPARAMETER_PAIR lpPairs,
  69. int dMaxPairs
  70. );
  71. };
  72. // helping functions
  73. BOOL InitProcess();
  74. BOOL CleanUpProcess();
  75. BOOL SetAclPerms(PACL * ppAcl);
  76. BOOL IsValidNumericParam(LPCTSTR pszParam, UINT cchParam);
  77. BOOL IsValidStringParam(LPCTSTR pszParam, UINT cchParam);
  78. #endif