Annotation of embedaddon/libpdel/ppp/ppp_pptp_server.h, revision 1.1
1.1 ! misho 1:
! 2: /*
! 3: * Copyright (c) 2001-2002 Packet Design, LLC.
! 4: * All rights reserved.
! 5: *
! 6: * Subject to the following obligations and disclaimer of warranty,
! 7: * use and redistribution of this software, in source or object code
! 8: * forms, with or without modifications are expressly permitted by
! 9: * Packet Design; provided, however, that:
! 10: *
! 11: * (i) Any and all reproductions of the source or object code
! 12: * must include the copyright notice above and the following
! 13: * disclaimer of warranties; and
! 14: * (ii) No rights are granted, in any manner or form, to use
! 15: * Packet Design trademarks, including the mark "PACKET DESIGN"
! 16: * on advertising, endorsements, or otherwise except as such
! 17: * appears in the above copyright notice or in the software.
! 18: *
! 19: * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
! 20: * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
! 21: * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
! 22: * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
! 23: * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
! 24: * OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
! 25: * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
! 26: * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
! 27: * RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE
! 28: * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
! 29: * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
! 30: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
! 31: * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
! 32: * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
! 33: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 34: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
! 35: * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
! 36: * THE POSSIBILITY OF SUCH DAMAGE.
! 37: *
! 38: * Author: Archie Cobbs <archie@freebsd.org>
! 39: */
! 40:
! 41: #ifndef _PDEL_PPP_PPP_PPTP_SERVER_H_
! 42: #define _PDEL_PPP_PPP_PPTP_SERVER_H_
! 43:
! 44: struct ppp_engine;
! 45: struct ppp_pptp_peer;
! 46: struct ppp_channel;
! 47:
! 48: /*
! 49: * Get the name of the remote peer of a PPTP control connection
! 50: * for the purposes of display in the logs.
! 51: *
! 52: * This method is optional; default logname is "<IP-Addr>:<Port>".
! 53: */
! 54: typedef void ppp_pptp_server_getlogname_t(void *arg, struct in_addr ip,
! 55: u_int16_t port, char *logname, size_t max);
! 56:
! 57: /*
! 58: * Callback for client to decide whether establishing a new PPTP
! 59: * connection from ip:port is ok or not.
! 60: *
! 61: * Should return a non-NULL cookie to let the channel be established.
! 62: * This argument becomes the 'carg' parameter to the 'plumb' and
! 63: * 'destroy' methods below; the destroy method below is guaranteed
! 64: * to be called exactly once if 'admit' returns a non-NULL cookie
! 65: * (unless ppp_pptp_server_close() is called first).
! 66: *
! 67: * The 'peer' may be used in a call to ppp_pptp_server_close() to
! 68: * close the associated PPTP connection before 'destroy' is called.
! 69: * If so, 'destroy' will not be called. Calling ppp_pptp_server_close()
! 70: * after 'destroy' has been called will cause a crash.
! 71: *
! 72: * If desired, a name for this link (for logging purposes) may be
! 73: * printed into the 'name' buffer, which has size 'nsize'.
! 74: *
! 75: * Note: we only allow one PPTP channel to be established within
! 76: * each control connection. So this will not be called if there is
! 77: * already a connection with ip:port.
! 78: */
! 79: typedef void *ppp_pptp_server_admit_t(void *arg, struct ppp_pptp_peer *peer,
! 80: struct in_addr ip, u_int16_t port,
! 81: struct ppp_auth_config *auth, char *name, size_t nsize);
! 82:
! 83: /*
! 84: * Callback to connect the ng_pptpgre(4) netgraph node to whatever
! 85: * node is going to handle the GRE packets.
! 86: *
! 87: * "path" points to the ng_pptpgre(4) node and "hook" is the name of
! 88: * the ng_pptpgre(4) hook to connect (i.e., NG_PPTPGRE_HOOK_LOWER).
! 89: *
! 90: * "ips" points to the local and remote external PPTP tunnel IP addresses.
! 91: */
! 92: typedef int ppp_pptp_server_plumb_t(void *arg, void *carg,
! 93: const char *path, const char *hook,
! 94: const struct in_addr *ips);
! 95:
! 96: /*
! 97: * Callback to tear down client state associated with a PPTP connection.
! 98: * All netgraph nodes, etc. should be removed.
! 99: *
! 100: * When this function is called, the ng_pptpgre(4) node will still exist
! 101: * at "path". After this function returns, it is destroyed.
! 102: *
! 103: * After this function is called, "carg" will not be used again.
! 104: */
! 105: typedef void ppp_pptp_server_destroy_t(void *arg,
! 106: void *carg, const char *path);
! 107:
! 108: /*
! 109: * Info supplied by client library to PPTP server.
! 110: */
! 111: struct ppp_pptp_server_info {
! 112: void *arg;
! 113: const char *vendor;
! 114: ppp_pptp_server_getlogname_t *getlogname;
! 115: ppp_pptp_server_admit_t *admit;
! 116: ppp_pptp_server_plumb_t *plumb;
! 117: ppp_pptp_server_destroy_t *destroy;
! 118: };
! 119:
! 120: __BEGIN_DECLS
! 121:
! 122: /* Functions */
! 123: extern int ppp_pptp_server_start(struct ppp_engine *engine,
! 124: const struct ppp_pptp_server_info *info,
! 125: struct in_addr ip, u_int16_t port, u_int max_conn);
! 126: extern void *ppp_pptp_server_get_client_info(struct ppp_channel *chan);
! 127: extern void ppp_pptp_server_close(struct ppp_engine *engine,
! 128: struct ppp_pptp_peer **peerp);
! 129: extern void ppp_pptp_server_stop(struct ppp_engine *engine);
! 130:
! 131: __END_DECLS
! 132:
! 133: #endif /* _PDEL_PPP_PPP_PPTP_SERVER_H_ */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>