summaryrefslogtreecommitdiff
path: root/accel-pptpd/ppp_lcp.h
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-08-17 17:29:46 +0400
committerKozlov Dmitry <dima@server>2010-08-17 17:29:46 +0400
commit760d8427f133df486a145e6e7ac7610caf2356fc (patch)
treeebd109efc8882e56165e05f050dd30c9313bb9c7 /accel-pptpd/ppp_lcp.h
parentab418b16bf2c9a57dbb7c18141af2eb283c44447 (diff)
downloadaccel-ppp-xebd-760d8427f133df486a145e6e7ac7610caf2356fc.tar.gz
accel-ppp-xebd-760d8427f133df486a145e6e7ac7610caf2356fc.zip
reworked/rewrited lcp handling code to become more abstract
Diffstat (limited to 'accel-pptpd/ppp_lcp.h')
-rw-r--r--accel-pptpd/ppp_lcp.h67
1 files changed, 65 insertions, 2 deletions
diff --git a/accel-pptpd/ppp_lcp.h b/accel-pptpd/ppp_lcp.h
index 5c77a3f..54235c4 100644
--- a/accel-pptpd/ppp_lcp.h
+++ b/accel-pptpd/ppp_lcp.h
@@ -3,13 +3,15 @@
#include <stdint.h>
+#include "triton/triton.h"
+#include "ppp_fsm.h"
/*
* Options.
*/
#define CI_VENDOR 0 /* Vendor Specific */
#define CI_MRU 1 /* Maximum Receive Unit */
#define CI_ASYNCMAP 2 /* Async Control Character Map */
-#define CI_AUTHTYPE 3 /* Authentication Type */
+#define CI_AUTH 3 /* Authentication Type */
#define CI_QUALITY 4 /* Quality Protocol */
#define CI_MAGIC 5 /* Magic Number */
#define CI_PCOMP 7 /* Protocol Field Compression */
@@ -39,7 +41,7 @@ struct lcp_hdr_t
} __attribute__((packed));
struct lcp_opt_hdr_t
{
- uint8_t type;
+ uint8_t id;
uint8_t len;
} __attribute__((packed));
struct lcp_opt8_t
@@ -58,7 +60,68 @@ struct lcp_opt32_t
uint32_t val;
} __attribute__((packed));
+/*struct lcp_options_t
+{
+ int magic;
+ int mtu;
+ int mru;
+ int accomp; // 0 - disabled, 1 - enable, 2 - allow, disabled, 3 - allow,enabled
+ int pcomp; // 0 - disabled, 1 - enable, 2 - allow, disabled, 3 - allow,enabled
+ // negotiated options;
+ int neg_mru;
+ int neg_mtu;
+ int neg_accomp; // -1 - rejected
+ int neg_pcomp;
+ int neg_auth[AUTH_MAX];
+};*/
+
+#define LCP_OPT_NONE 0
+#define LCP_OPT_ACK 1
+#define LCP_OPT_NAK -1
+#define LCP_OPT_REJ -2
+#define LCP_OPT_FAIL -3
+
+struct ppp_lcp_t;
+struct lcp_option_handler_t;
+
+struct lcp_option_t
+{
+ struct list_head entry;
+ int id;
+ int len;
+ int state;
+ struct lcp_option_handler_t *h;
+};
+
+struct lcp_option_handler_t
+{
+ struct list_head entry;
+ struct lcp_option_t* (*init)(struct ppp_lcp_t*);
+ int (*send_conf_req)(struct ppp_lcp_t*,struct lcp_option_t*,uint8_t*);
+ int (*send_conf_rej)(struct ppp_lcp_t*,struct lcp_option_t*,uint8_t*);
+ int (*send_conf_nak)(struct ppp_lcp_t*,struct lcp_option_t*,uint8_t*);
+ int (*recv_conf_req)(struct ppp_lcp_t*,struct lcp_option_t*,uint8_t*);
+ int (*recv_conf_rej)(struct ppp_lcp_t*,struct lcp_option_t*,uint8_t*);
+ int (*recv_conf_nak)(struct ppp_lcp_t*,struct lcp_option_t*,uint8_t*);
+ int (*recv_conf_ack)(struct ppp_lcp_t*,struct lcp_option_t*,uint8_t*);
+ void (*free)(struct ppp_lcp_t*,struct lcp_option_t*);
+ void (*print)(void (*print)(const char *fmt,...), struct lcp_option_t*,uint8_t*);
+};
+
+struct ppp_lcp_t
+{
+ struct ppp_handler_t hnd;
+ struct ppp_fsm_t fsm;
+ struct ppp_t *ppp;
+ struct list_head options;
+
+ struct list_head ropt_list; // last received ConfReq
+ int ropt_len;
+
+ int conf_req_len;
+};
+int lcp_option_register(struct lcp_option_handler_t *h);
#endif