home *** CD-ROM | disk | FTP | other *** search
/ The Elite Hackers Toolkit / TheEliteHackersToolkitVolume1_1998.rar / HACKERS.BIN / hackers / anger_tar.tar / anger.tar / anger / pptp.h < prev   
C/C++ Source or Header  |  1998-08-06  |  8KB  |  234 lines

  1. #define PPTP_MAGIC 0x1A2B3C4D /* Magic cookie for PPTP datagrams */
  2. #define PPTP_PORT  1723       /* PPTP TCP port number            */
  3. #define PPTP_PROTO 47         /* PPTP IP protocol number         */
  4.  
  5. #define PPTP_MESSAGE_CONTROL            1
  6. #define PPTP_MESSAGE_MANAGE             2
  7.  
  8. #define PPTP_VERSION_STRING     "1.00"
  9. #define PPTP_VERSION            0x100
  10. #define PPTP_FIRMWARE_STRING    "0.01"
  11. #define PPTP_FIRMWARE_VERSION   0x001
  12.  
  13. /* (Control Connection Management) */
  14. #define PPTP_START_CTRL_CONN_RQST       1
  15. #define PPTP_START_CTRL_CONN_RPLY       2
  16. #define PPTP_STOP_CTRL_CONN_RQST        3
  17. #define PPTP_STOP_CTRL_CONN_RPLY        4
  18. #define PPTP_ECHO_RQST                  5
  19. #define PPTP_ECHO_RPLY                  6
  20.  
  21. /* (Call Management) */
  22. #define PPTP_OUT_CALL_RQST              7
  23. #define PPTP_OUT_CALL_RPLY              8
  24. #define PPTP_IN_CALL_RQST               9
  25. #define PPTP_IN_CALL_RPLY               10
  26. #define PPTP_IN_CALL_CONNECT            11
  27. #define PPTP_CALL_CLEAR_RQST            12
  28. #define PPTP_CALL_CLEAR_NTFY            13
  29.  
  30. /* (Error Reporting) */
  31. #define PPTP_WAN_ERR_NTFY               14
  32.  
  33. /* (PPP Session Control) */
  34. #define PPTP_SET_LINK_INFO              15
  35.  
  36. /* (Framing capabilities for msg sender) */
  37. #define PPTP_FRAME_ASYNC        1
  38. #define PPTP_FRAME_SYNC         2
  39. #define PPTP_FRAME_ANY          3
  40.  
  41. /* (Bearer capabilities for msg sender) */
  42. #define PPTP_BEARER_ANALOG      1
  43. #define PPTP_BEARER_DIGITAL     2
  44. #define PPTP_BEARER_ANY         3
  45.  
  46. struct pptp_header {
  47.   u_int16_t length;       /* message length in octets, including header */
  48.   u_int16_t pptp_type;    /* PPTP message type. 1 for control message.  */
  49.   u_int32_t magic;        /* this should be PPTP_MAGIC.                 */
  50.   u_int16_t ctrl_type;    /* Control message type (0-15)                */
  51.   u_int16_t reserved0;    /* reserved.  MUST BE ZERO.                   */
  52. };
  53.  
  54. struct pptp_start_ctrl_conn { /* for control message types 1 and 2 */
  55.   struct pptp_header header;
  56.  
  57.   u_int16_t version;      /* PPTP protocol version.  = PPTP_VERSION     */
  58.   u_int8_t  result_code;  /* these two fields should be zero on rqst msg*/
  59.   u_int8_t  error_code;   /* 0 unless result_code==2 (General Error)    */
  60.   u_int32_t framing_cap;  /* Framing capabilities                       */
  61.   u_int32_t bearer_cap;   /* Bearer Capabilities                        */
  62.   u_int16_t max_channels; /* Maximum Channels (=0 for PNS, PAC ignores) */
  63.   u_int16_t firmware_rev; /* Firmware or Software Revision              */
  64.   u_int8_t  hostname[64]; /* Host Name (64 octets, zero terminated)     */
  65.   u_int8_t  vendor[64];   /* Vendor string (64 octets, zero term.)      */
  66.   /* MS says that end of hostname/vendor fields should be filled with   */
  67.   /* octets of value 0, but Win95 PPTP driver doesn't do this.          */
  68. };
  69.  
  70. struct pptp_out_call_rqst { /* for control message type 7 */
  71.   struct pptp_header header;
  72.   u_int16_t call_id;      /* Call ID (unique id used to multiplex data)  */
  73.   u_int16_t call_sernum;  /* Call Serial Number (used for logging)       */
  74.   u_int32_t bps_min;      /* Minimum BPS (lowest acceptable line speed)  */
  75.   u_int32_t bps_max;      /* Maximum BPS (highest acceptable line speed) */
  76.   u_int32_t bearer;       /* Bearer type                                 */
  77.   u_int32_t framing;      /* Framing type                                */
  78.   u_int16_t recv_size;    /* Recv. Window Size (no. of buffered packets) */
  79.   u_int16_t delay;        /* Packet Processing Delay (in 1/10 sec)       */
  80.   u_int16_t phone_len;    /* Phone Number Length (num. of valid digits)  */
  81.   u_int16_t reserved1;    /* MUST BE ZERO                                */
  82.   u_int8_t  phone_num[64]; /* Phone Number (64 octets, null term.)       */
  83.   u_int8_t subaddress[64]; /* Subaddress (64 octets, null term.)         */
  84. };
  85.  
  86. struct pptp_out_call_rply { /* for control message type 8 */
  87.   struct pptp_header header;
  88.   u_int16_t call_id;      /* Call ID (used to multiplex data over tunnel)*/
  89.   u_int16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
  90.   u_int8_t  result_code;  /* Result Code (1 is no errors)                */
  91.   u_int8_t  error_code;   /* Error Code (=0 unless result_code==2)       */
  92.   u_int16_t cause_code;   /* Cause Code (addt'l failure information)     */
  93.   u_int32_t speed;        /* Connect Speed (in BPS)                      */
  94.   u_int16_t recv_size;    /* Recv. Window Size (no. of buffered packets) */
  95.   u_int16_t delay;        /* Packet Processing Delay (in 1/10 sec)       */
  96.   u_int32_t channel;      /* Physical Channel ID (for logging)           */
  97. };
  98.  
  99. struct pptp_set_link_info {   /* for control message type 15 */
  100.   struct pptp_header header;
  101.   u_int16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst) */
  102.   u_int16_t reserved1;    /* MUST BE ZERO                                   */
  103.   u_int32_t send_accm;    /* Send ACCM (for PPP packets; default 0xFFFFFFFF)*/
  104.   u_int32_t recv_accm;    /* Receive ACCM (for PPP pack.;default 0xFFFFFFFF)*/
  105. };
  106.  
  107. #define PPTP_GRE_PROTO  0x880B
  108. #define PPTP_GRE_VER    0x1
  109.  
  110. #define PPTP_GRE_FLAG_C 0x80
  111. #define PPTP_GRE_FLAG_R 0x40
  112. #define PPTP_GRE_FLAG_K 0x20
  113. #define PPTP_GRE_FLAG_S 0x10
  114. #define PPTP_GRE_FLAG_A 0x80
  115.  
  116. #define PPTP_GRE_IS_C(f) ((f)&PPTP_GRE_FLAG_C)
  117. #define PPTP_GRE_IS_R(f) ((f)&PPTP_GRE_FLAG_R)
  118. #define PPTP_GRE_IS_K(f) ((f)&PPTP_GRE_FLAG_K)
  119. #define PPTP_GRE_IS_S(f) ((f)&PPTP_GRE_FLAG_S)
  120. #define PPTP_GRE_IS_A(f) ((f)&PPTP_GRE_FLAG_A)
  121.  
  122. struct pptp_gre_header {
  123.   u_int8_t flags;               /* bitfield */
  124.   u_int8_t ver;                 /* should be PPTP_GRE_VER (enhanced GRE) */
  125.   u_int16_t protocol;           /* should be PPTP_GRE_PROTO (ppp-encaps) */
  126.   u_int16_t payload_len;        /* size of ppp payload, not inc. gre header */
  127.   u_int16_t call_id;            /* peer's call_id for this session */
  128.   u_int32_t seq;                /* sequence number.  Present if S==1 */
  129.   u_int32_t ack;                /* seq number of highest packet recieved by */
  130.                                 /*  sender in this session */
  131. };
  132.  
  133. #define PACKET_MAX 8196
  134.  
  135. #define PPP_ADDRESS                     0xFF
  136. #define PPP_CONTROL                     0x03
  137.  
  138. /* PPP Protocols */
  139. #define PPP_PROTO_LCP                   0xc021
  140. #define PPP_PROTO_CHAP                  0xc223
  141.  
  142. /* LCP Codes */
  143. #define PPP_LCP_CODE_CONF_RQST          1
  144. #define PPP_LCP_CODE_CONF_ACK           2
  145. #define PPP_LCP_CODE_IDENT              12
  146.  
  147. /* LCP Config Options */
  148. #define PPP_LCP_CONFIG_OPT_AUTH         3
  149. #define PPP_LCP_CONFIG_OPT_MAGIC        5
  150. #define PPP_LCP_CONFIG_OPT_PFC          7
  151. #define PPP_LCP_CONFIG_OPT_ACFC         8
  152.  
  153. /* Auth Algorithms */
  154. #define PPP_LCP_AUTH_CHAP_ALGO_MSCHAP   0x80
  155.  
  156. /* CHAP Codes */
  157. #define PPP_CHAP_CODE_CHALLENGE                 1
  158. #define PPP_CHAP_CODE_RESPONCE                  2
  159. #define PPP_CHAP_CODE_SUCESS                    3
  160. #define PPP_CHAP_CODE_FAILURE                   4
  161. #define PPP_CHAP_CODE_MSCHAP_PASSWORD_V1        5
  162. #define PPP_CHAP_CODE_MSCHAP_PASSWORD_V2        6
  163.  
  164. #define PPP_CHAP_CHALLENGE_SIZE         8
  165. #define PPP_CHAP_RESPONCE_SIZE          49
  166.  
  167. #define MSCHAP_ERROR    "E=648 R=0"
  168.  
  169. struct ppp_header {
  170.     u_int8_t address;
  171.     u_int8_t control;
  172.     u_int16_t proto;
  173. };
  174.  
  175. struct ppp_lcp_chap_header {
  176.   u_int8_t code;
  177.   u_int8_t ident;
  178.   u_int16_t length;
  179. };
  180.  
  181. struct ppp_lcp_packet {
  182.   struct ppp_header ppp;
  183.   struct ppp_lcp_chap_header lcp;
  184. };
  185.  
  186. struct ppp_lcp_chap_auth_option {
  187.   u_int8_t type;
  188.   u_int8_t length;
  189.   u_int16_t auth_proto;
  190.   u_int8_t algorithm;
  191. };
  192.  
  193. struct ppp_lcp_magic_option {
  194.   u_int8_t type;
  195.   u_int8_t length;
  196.   u_int32_t magic;
  197. };
  198.  
  199. struct ppp_lcp_pfc_option {
  200.   u_int8_t type;
  201.   u_int8_t length;
  202. };
  203.  
  204. struct ppp_lcp_acfc_option {
  205.   u_int8_t type;
  206.   u_int8_t length;
  207. };
  208.  
  209. struct ppp_chap_challenge {
  210.   u_int8_t size;
  211.   union {
  212.     unsigned char challenge[8];
  213.     struct {
  214.       unsigned char lanman[24];
  215.       unsigned char nt[24];
  216.       u_int8_t flag;
  217.     } responce;
  218.   } value;
  219.   /* name */
  220. };
  221.  
  222. struct ppp_mschap_change_password {
  223.   char old_lanman[16];
  224.   char new_lanman[16];
  225.   char old_nt[16];
  226.   char new_nt[16];
  227.   u_int16_t pass_length;
  228.   u_int16_t flags;
  229. };
  230.  
  231. #define ppp_chap_responce       ppp_chap_challenge
  232.  
  233.  
  234.