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.

52 lines
1.5 KiB

  1. /* (C) 1997 Microsoft corp.
  2. *
  3. * file : X224.c
  4. * author : Erik Mavrinac
  5. *
  6. * description: X.224 functions for encoding and decoding X.224 packets for
  7. * MCS.
  8. */
  9. #include "precomp.h"
  10. #pragma hdrstop
  11. #include <MCSImpl.h>
  12. /*
  13. * X.224 connection-confirm packet is laid out as follows:
  14. * Byte Contents
  15. * ---- --------
  16. * 0 RFC1006 version number, must be 0x03.
  17. * 1 RFC1006 Reserved, must be 0x00.
  18. * 2 RFC1006 MSB of word-sized total-frame length (incl. X.224 header).
  19. * 3 RFC1006 LSB of word-sized total-frame length.
  20. * 4 Length Indicator, the size of the header bytes following (== 2).
  21. * 5 Connection confirm indicator, 0xD0.
  22. * 6 MSB of destination socket/port # on receiving machine.
  23. * 7 LSB of destination socket/port #.
  24. * 8 MSB of source socket/port # on sending machine.
  25. * 9 LSB of source socket/port #.
  26. * 10 Protocol class. Should be 0x00 (X.224 class 0).
  27. */
  28. void CreateX224ConnectionConfirmPacket(
  29. BYTE *pBuffer,
  30. unsigned DestPort,
  31. unsigned SrcPort)
  32. {
  33. // RFC1006 header.
  34. pBuffer[0] = 0x03;
  35. pBuffer[1] = 0x00;
  36. pBuffer[2] = 0x00;
  37. pBuffer[3] = X224_ConnectionConPacketSize;
  38. // Connection confirm TPDU header.
  39. pBuffer[4] = 6; // # following bytes.
  40. pBuffer[5] = X224_ConnectionCon;
  41. pBuffer[6] = (DestPort & 0xFF00) >> 8;
  42. pBuffer[7] = (DestPort & 0x00FF);
  43. pBuffer[8] = (SrcPort & 0xFF00) >> 8;
  44. pBuffer[9] = (SrcPort & 0x00FF);
  45. pBuffer[10] = 0x00;
  46. }