diff options
author | Kozlov Dmitry <dima@server> | 2010-10-11 18:19:37 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-10-11 18:19:37 +0400 |
commit | aebda049dcd1999080d52c813a40cc85f8377d04 (patch) | |
tree | be0223170f664eab1745784a6d895080fff8a9eb /accel-pptpd/ctrl/l2tp/l2tp.h | |
parent | 42972cf14d2efcfec6902bce896cde43f4242935 (diff) | |
download | accel-ppp-aebda049dcd1999080d52c813a40cc85f8377d04.tar.gz accel-ppp-aebda049dcd1999080d52c813a40cc85f8377d04.zip |
started work on L2TPv2 server
Diffstat (limited to 'accel-pptpd/ctrl/l2tp/l2tp.h')
-rw-r--r-- | accel-pptpd/ctrl/l2tp/l2tp.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/accel-pptpd/ctrl/l2tp/l2tp.h b/accel-pptpd/ctrl/l2tp/l2tp.h new file mode 100644 index 00000000..a99bdc35 --- /dev/null +++ b/accel-pptpd/ctrl/l2tp/l2tp.h @@ -0,0 +1,84 @@ +#ifndef __L2TP_H +#define __L2TP_H + +#include <netinet/in.h> + +#include "list.h" +#include "l2tp_prot.h" + +#define ATTR_TYPE_NONE 0 +#define ATTR_TYPE_INT16 1 +#define ATTR_TYPE_INT32 2 +#define ATTR_TYPE_INT64 3 +#define ATTR_TYPE_OCTETS 4 +#define ATTR_TYPE_STRING 5 + +#define L2TP_MAX_PACKET_SIZE 65536 +#define L2TP_MAX_TID 65534 + +#define L2TP_V2_PROTOCOL_VERSION ( 1 << 8 | 0 ) + +typedef union +{ + uint32_t uint32; + int32_t int32; + uint16_t uint16; + int16_t int16; + uint64_t uint64; + uint8_t *octets; + char *string; +} l2tp_value_t; + +struct l2tp_dict_attr_t +{ + struct list_head entry; + const char *name; + int id; + int type; + int M; + int H; + struct list_head values; +}; + +struct l2tp_dict_value_t +{ + struct list_head entry; + const char *name; + l2tp_value_t val; +}; + +struct l2tp_attr_t +{ + struct list_head entry; + struct l2tp_dict_attr_t *attr; + int M:1; + int H:1; + int length; + l2tp_value_t val; +}; + +struct l2tp_packet_t +{ + struct list_head entry; + struct sockaddr_in addr; + struct l2tp_hdr_t hdr; + struct list_head attrs; +}; + +extern int conf_verbose; + +struct l2tp_dict_attr_t *l2tp_dict_find_attr_by_name(const char *name); +struct l2tp_dict_attr_t *l2tp_dict_find_attr_by_id(int id); +struct l2tp_dict_value_t *l2tp_dict_find_value(struct l2tp_dict_attr_t *attr, l2tp_value_t val); + +int l2tp_recv(int fd, struct l2tp_packet_t **); +void l2tp_packet_free(struct l2tp_packet_t *); +void l2tp_packet_print(struct l2tp_packet_t *); +struct l2tp_packet_t *l2tp_packet_alloc(int ver, int msg_type, struct sockaddr_in *addr); +int l2tp_packet_send(int sock, struct l2tp_packet_t *); +int l2tp_packet_add_int16(struct l2tp_packet_t *pack, int id, int16_t val); +int l2tp_packet_add_int32(struct l2tp_packet_t *pack, int id, int32_t val); +int l2tp_packet_add_string(struct l2tp_packet_t *pack, int id, const char *val); +int l2tp_packet_add_octets(struct l2tp_packet_t *pack, int id, const uint8_t *val, int size); + +#endif |