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.

171 lines
3.2 KiB

  1. /*
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. */
  4. #include "sdppch.h"
  5. #include "sdporigi.h"
  6. #include "sdpltran.h"
  7. // line transition states
  8. enum ORIGIN_TRANSITION_STATES
  9. {
  10. ORIGIN_START,
  11. ORIGIN_USER_NAME,
  12. ORIGIN_SESSION_ID,
  13. ORIGIN_SESSION_VERSION,
  14. ORIGIN_NETWORK_TYPE,
  15. ORIGIN_ADDRESS_TYPE,
  16. ORIGIN_ADDRESS
  17. };
  18. // table for origin line transitions
  19. const LINE_TRANSITION g_OriginStartTransitions[] = {
  20. {CHAR_BLANK, ORIGIN_USER_NAME}
  21. };
  22. const LINE_TRANSITION g_OriginUserNameTransitions[] = {
  23. {CHAR_BLANK, ORIGIN_SESSION_ID}
  24. };
  25. const LINE_TRANSITION g_OriginSessionIdTransitions[]= {
  26. {CHAR_BLANK, ORIGIN_SESSION_VERSION}
  27. };
  28. const LINE_TRANSITION g_OriginSessionVersionTransitions[]= {
  29. {CHAR_BLANK, ORIGIN_NETWORK_TYPE}
  30. };
  31. const LINE_TRANSITION g_OriginNetworkTypeTransitions[]= {
  32. {CHAR_BLANK, ORIGIN_ADDRESS_TYPE}
  33. };
  34. const LINE_TRANSITION g_OriginAddressTypeTransitions[]= {
  35. {CHAR_NEWLINE, ORIGIN_ADDRESS}
  36. };
  37. /* no transitions */
  38. const LINE_TRANSITION *g_OriginAddressTransitions = NULL;
  39. LINE_TRANSITION_INFO g_OriginTransitionInfo[] = {
  40. LINE_TRANSITION_ENTRY(ORIGIN_START, g_OriginStartTransitions),
  41. LINE_TRANSITION_ENTRY(ORIGIN_USER_NAME, g_OriginUserNameTransitions),
  42. LINE_TRANSITION_ENTRY(ORIGIN_SESSION_ID, g_OriginSessionIdTransitions),
  43. LINE_TRANSITION_ENTRY(ORIGIN_SESSION_VERSION,g_OriginSessionVersionTransitions),
  44. LINE_TRANSITION_ENTRY(ORIGIN_NETWORK_TYPE, g_OriginNetworkTypeTransitions),
  45. LINE_TRANSITION_ENTRY(ORIGIN_ADDRESS_TYPE, g_OriginAddressTypeTransitions),
  46. LINE_TRANSITION_ENTRY(ORIGIN_ADDRESS, g_OriginAddressTransitions)
  47. };
  48. SDP_LINE_TRANSITION g_OriginTransition(
  49. g_OriginTransitionInfo,
  50. sizeof(g_OriginTransitionInfo)/sizeof(LINE_TRANSITION_INFO)
  51. );
  52. SDP_ORIGIN::SDP_ORIGIN(
  53. )
  54. : SDP_VALUE(SDP_INVALID_ORIGIN_FIELD, ORIGIN_STRING, &g_OriginTransition),
  55. m_NetworkType(LIMITED_NETWORK_TYPES, NUM_NETWORK_TYPES),
  56. m_AddressType(LIMITED_ADDRESS_TYPES, NUM_ADDRESS_TYPES)
  57. {
  58. }
  59. void
  60. SDP_ORIGIN::InternalReset(
  61. )
  62. {
  63. m_UserName.Reset();
  64. m_SessionId.Reset();
  65. m_SessionVersion.Reset();
  66. m_NetworkType.Reset();
  67. m_AddressType.Reset();
  68. m_Address.Reset();
  69. }
  70. BOOL
  71. SDP_ORIGIN::GetField(
  72. OUT SDP_FIELD *&Field,
  73. OUT BOOL &AddToArray
  74. )
  75. {
  76. // add in all cases by default
  77. AddToArray = TRUE;
  78. switch(m_LineState)
  79. {
  80. case ORIGIN_USER_NAME:
  81. {
  82. Field = &m_UserName;
  83. }
  84. break;
  85. case ORIGIN_SESSION_ID:
  86. {
  87. Field = &m_SessionId;
  88. }
  89. break;
  90. case ORIGIN_SESSION_VERSION:
  91. {
  92. Field = &m_SessionVersion;
  93. }
  94. break;
  95. case ORIGIN_NETWORK_TYPE:
  96. {
  97. Field = &m_NetworkType;
  98. }
  99. break;
  100. case ORIGIN_ADDRESS_TYPE:
  101. {
  102. Field = &m_AddressType;
  103. }
  104. break;
  105. case ORIGIN_ADDRESS:
  106. {
  107. Field = &m_Address;
  108. }
  109. break;
  110. default:
  111. {
  112. SetLastError(m_ErrorCode);
  113. return FALSE;
  114. }
  115. break;
  116. };
  117. return TRUE;
  118. }