123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- #ifndef NET_PIPEX_H
- #define NET_PIPEX_H 1
- #define PIPEXCTL_ENABLE 1
- #define PIPEXCTL_INQ 2
- #define PIPEXCTL_OUTQ 3
- #define PIPEXCTL_MAXID 4
- #define PIPEXCTL_NAMES { \
- { 0, 0 }, \
- { "enable", CTLTYPE_INT }, \
- { "inq", CTLTYPE_NODE }, \
- { "outq", CTLTYPE_NODE }, \
- }
- #define PIPEX_PROTO_L2TP 1
- #define PIPEX_PROTO_PPTP 2
- #define PIPEX_PROTO_PPPOE 3
- #define PIPEX_MAX_LISTREQ 128
- #define PIPEX_MPPE_KEYLEN 16
- struct pipex_mppe_req {
- int16_t stateless;
- int16_t keylenbits;
- u_char master_key[PIPEX_MPPE_KEYLEN];
- };
- struct pipex_statistics {
- uint32_t ipackets;
- uint32_t ierrors;
- uint64_t ibytes;
- uint32_t opackets;
- uint32_t oerrors;
- uint64_t obytes;
- uint32_t idle_time;
- };
- struct pipex_session_req {
- int pr_protocol;
-
- uint16_t pr_session_id;
- uint16_t pr_peer_session_id;
- uint32_t pr_ppp_flags;
- #define PIPEX_PPP_ACFC_ACCEPTED 0x0001
- #define PIPEX_PPP_PFC_ACCEPTED 0x0002
- #define PIPEX_PPP_ACFC_ENABLED 0x0004
- #define PIPEX_PPP_PFC_ENABLED 0x0008
- #define PIPEX_PPP_MPPE_ACCEPTED 0x0010
- #define PIPEX_PPP_MPPE_ENABLED 0x0020
- #define PIPEX_PPP_MPPE_REQUIRED 0x0040
- #define PIPEX_PPP_HAS_ACF 0x0080
- #define PIPEX_PPP_ADJUST_TCPMSS 0x0100
- #define PIPEX_PPP_INGRESS_FILTER 0x0200
- int8_t pr_ccp_id;
- int pr_ppp_id;
- uint16_t pr_peer_mru;
- uint32_t pr_timeout_sec;
- struct in_addr pr_ip_srcaddr;
- struct in_addr pr_ip_address;
- struct in_addr pr_ip_netmask;
- struct sockaddr_in6 pr_ip6_address;
- int pr_ip6_prefixlen;
- union {
- struct {
- uint32_t snd_nxt;
- uint32_t rcv_nxt;
- uint32_t snd_una;
- uint32_t rcv_acked;
- int winsz;
- int maxwinsz;
- int peer_maxwinsz;
- } pptp;
- struct {
- uint32_t option_flags;
- #define PIPEX_L2TP_USE_SEQUENCING 0x00000001
- uint16_t tunnel_id;
- uint16_t peer_tunnel_id;
- uint32_t ns_nxt;
- uint32_t nr_nxt;
- uint32_t ns_una;
- uint32_t nr_acked;
- uint32_t ipsecflowinfo;
- } l2tp;
- struct {
- char over_ifname[IF_NAMESIZE];
- } pppoe;
- } pr_proto;
- struct sockaddr_storage pr_peer_address;
- struct sockaddr_storage pr_local_address;
- struct pipex_mppe_req pr_mppe_recv;
- struct pipex_mppe_req pr_mppe_send;
- };
- struct pipex_session_stat_req {
- int psr_protocol;
- uint16_t psr_session_id;
- struct pipex_statistics psr_stat;
- };
- struct pipex_session_close_req {
- int psr_protocol;
- uint16_t psr_session_id;
- struct pipex_statistics psr_stat;
- };
- #define pcr_protocol psr_protocol
- #define pcr_session_id psr_session_id
- #define pcr_stat psr_stat
- struct pipex_session_list_req {
- uint8_t plr_flags;
- #define PIPEX_LISTREQ_MORE 0x01
- int plr_ppp_id_count;
- int plr_ppp_id[PIPEX_MAX_LISTREQ];
- };
- struct pipex_session_config_req {
- int pcr_protocol;
- uint16_t pcr_session_id;
- int pcr_ip_forward;
- };
- struct pppx_hdr {
- u_int32_t pppx_proto;
- u_int32_t pppx_id;
- };
- struct pipex_session_descr_req {
- int pdr_protocol;
- uint16_t pdr_session_id;
- char pdr_descr[IFDESCRSIZE];
- };
- #define PIPEXSMODE _IOW ('p', 1, int)
- #define PIPEXGMODE _IOR ('p', 2, int)
- #define PIPEXASESSION _IOW ('p', 3, struct pipex_session_req)
- #define PIPEXDSESSION _IOWR('p', 4, struct pipex_session_close_req)
- #define PIPEXCSESSION _IOW ('p', 5, struct pipex_session_config_req)
- #define PIPEXGSTAT _IOWR('p', 6, struct pipex_session_stat_req)
- #define PIPEXGCLOSED _IOR ('p', 7, struct pipex_session_list_req)
- #define PIPEXSIFDESCR _IOW ('p', 8, struct pipex_session_descr_req)
- #ifdef _KERNEL
- extern int pipex_enable;
- struct pipex_session;
- struct pipex_iface_context {
- struct ifnet *ifnet_this;
- u_int pipexmode;
-
- struct pipex_session *multicast_session;
- };
- __BEGIN_DECLS
- void pipex_init (void);
- void pipex_iface_init (struct pipex_iface_context *, struct ifnet *);
- void pipex_iface_fini (struct pipex_iface_context *);
- int pipex_notify_close_session(struct pipex_session *session);
- int pipex_notify_close_session_all(void);
- struct mbuf *pipex_output (struct mbuf *, int, int, struct pipex_iface_context *);
- struct pipex_session *pipex_pppoe_lookup_session (struct mbuf *);
- struct pipex_session *pipex_pppoe_lookup_session (struct mbuf *);
- struct mbuf *pipex_pppoe_input (struct mbuf *, struct pipex_session *);
- struct pipex_session *pipex_pptp_lookup_session (struct mbuf *);
- struct mbuf *pipex_pptp_input (struct mbuf *, struct pipex_session *);
- struct pipex_session *pipex_pptp_userland_lookup_session_ipv4 (struct mbuf *, struct in_addr);
- struct pipex_session *pipex_pptp_userland_lookup_session_ipv6 (struct mbuf *, struct in6_addr);
- struct pipex_session *pipex_l2tp_userland_lookup_session(struct mbuf *, struct sockaddr *);
- struct mbuf *pipex_pptp_userland_output (struct mbuf *, struct pipex_session *);
- struct pipex_session *pipex_l2tp_lookup_session (struct mbuf *, int);
- struct mbuf *pipex_l2tp_input (struct mbuf *, int off, struct pipex_session *, uint32_t);
- struct pipex_session *pipex_l2tp_userland_lookup_session_ipv4 (struct mbuf *, struct in_addr);
- struct pipex_session *pipex_l2tp_userland_lookup_session_ipv6 (struct mbuf *, struct in6_addr);
- struct mbuf *pipex_l2tp_userland_output (struct mbuf *, struct pipex_session *);
- int pipex_ioctl (struct pipex_iface_context *, u_long, caddr_t);
- void pipex_session_init_mppe_recv(struct pipex_session *, int,
- int, u_char *);
- void pipex_session_init_mppe_send(struct pipex_session *, int,
- int, u_char *);
- __END_DECLS
- #endif
- #endif
|