summaryrefslogtreecommitdiff
path: root/accel-pptpd/ppp.h
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-08-10 17:10:57 +0400
committerKozlov Dmitry <dima@server>2010-08-10 17:10:57 +0400
commit5286c9d19031c93a785a4d8729abf9e6a1710f98 (patch)
treebf6d60b1e8a0593afce333c80d6514d709c1151e /accel-pptpd/ppp.h
parent4a268755565ced740c391a4c8c7fc7c98b7fc3c7 (diff)
downloadaccel-ppp-xebd-5286c9d19031c93a785a4d8729abf9e6a1710f98.tar.gz
accel-ppp-xebd-5286c9d19031c93a785a4d8729abf9e6a1710f98.zip
working on PAP
Diffstat (limited to 'accel-pptpd/ppp.h')
-rw-r--r--accel-pptpd/ppp.h48
1 files changed, 17 insertions, 31 deletions
diff --git a/accel-pptpd/ppp.h b/accel-pptpd/ppp.h
index 13e6934..a48f00d 100644
--- a/accel-pptpd/ppp.h
+++ b/accel-pptpd/ppp.h
@@ -72,40 +72,13 @@ struct ppp_t
struct list_head layers;
};
-struct ppp_fsm_handler_t
+struct ppp_handler_t
{
- void (*reset_conf)(struct ppp_t *ppp); /* Reset our Configuration Information */
- int (*conf_length)(struct ppp_t *ppp); /* Length of our Configuration Information */
- void (*add_conf)(struct ppp_t *ppp, unsigned char *, int *); /* Add our Configuration Information */
- int (*ack_conf)(struct ppp_t *ppp, unsigned char *,int); /* ACK our Configuration Information */
- int (*nak_conf)(struct ppp_t *ppp, unsigned char *,int,int); /* NAK our Configuration Information */
- int (*rej_conf)(struct ppp_t *ppp, unsigned char *,int); /* Reject our Configuration Information */
- int (*req_conf)(struct ppp_t *ppp, unsigned char *,int *,int); /* Request peer's Configuration Information */
- void (*opened)(struct ppp_t *ppp); /* Called when fsm reaches OPENED state */
- void (*down)(struct ppp_t *ppp); /* Called when fsm leaves OPENED state */
- void (*starting)(struct ppp_t *ppp); /* Called when we want the lower layer */
- void (*finished)(struct ppp_t *ppp); /* Called when we don't want the lower layer */
- void (*protreject)(struct ppp_t *ppp,int); /* Called when Protocol-Reject received */
- void (*retransmit)(struct ppp_t *ppp); /* Retransmission is necessary */
- int (*extcode)(struct ppp_t *ppp, int, int, unsigned char *, int); /* Called when unknown code received */
- char *proto_name; /* String name for protocol (for messages) */
+ struct list_head entry;
+ int proto;
+ void (*recv)(struct ppp_handler_t*);
};
-struct ppp_hdr_t
-{
- u_int8_t code;
- u_int8_t id;
- u_int16_t len;
- u_int8_t data[100];
-}__attribute__((packed));
-
-struct ppp_opt_t
-{
- u_int8_t type;
- u_int16_t len;
- u_int8_t data[100];
-}__attribute__((packed));
-
struct ppp_t *alloc_ppp(void);
int establish_ppp(struct ppp_t *ppp);
int ppp_send(struct ppp_t *ppp, void *data, int size);
@@ -114,4 +87,17 @@ void ppp_init(void);
struct ppp_layer_t* ppp_lcp_init(struct ppp_t *ppp);
+
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+#endif /* __KERNEL__ */
+
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
#endif