Source code of Windows XP (NT5)
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.

107 lines
3.3 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. // query parameter that will be passed from client to the ISA
  43. typedef struct _query_parameter {
  44. int m_dOSArch;
  45. int m_dOSType;
  46. int m_dLCID;
  47. char m_achOSVer[VERSION_LEN];
  48. char m_achCMVer[VERSION_LEN];
  49. char m_achPB[VERSION_LEN];
  50. int m_dPBVer;
  51. } QUERY_PARAMETER, *LPQUERY_PARAMETER;
  52. class CPhoneBkServer
  53. {
  54. private:
  55. BOOL m_bInitialized;
  56. QUERY_PARAMETER m_QueryParameter;
  57. public:
  58. BOOL GetExtensionVersion(LPHSE_VERSION_INFO pVer);
  59. DWORD HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpEcb);
  60. protected:
  61. BOOL GetQueryParameter(char *pszQuery, LPQUERY_PARAMETER lpQueryParamter);
  62. void FormSQLQuery(char *pszQuery, char *pszService, int dLCID, int dOSType, int dOSArch);
  63. void BuildStatusCode(LPTSTR pszResponse, DWORD dwCode);
  64. DWORD GetFileLength(LPSTR lpszFileName);
  65. BOOL SendFile(LPEXTENSION_CONTROL_BLOCK lpEcb, LPSTR lpszFileName, BOOL bWait);
  66. BOOL Virtual2Physical(
  67. LPEXTENSION_CONTROL_BLOCK lpEcb,
  68. char *pszVirtualPath,
  69. char *pszPhysicalPath
  70. );
  71. int GetParameterPairs(
  72. char *pszInputString,
  73. LPPARAMETER_PAIR lpPairs,
  74. int dMaxPairs
  75. );
  76. };
  77. // helping functions
  78. BOOL InitProcess();
  79. BOOL CleanUpProcess();
  80. BOOL InitDBNames();
  81. BOOL UpdatePhoneBook();
  82. BOOL InitializeSharedMem(SECURITY_ATTRIBUTES sa);
  83. //BOOL GrantPermissions( LPTSTR Object );
  84. void CleanUpSharedMem();
  85. BOOL GetSemaphore();
  86. BOOL SetAclPerms(PACL * ppAcl);
  87. #endif