1/* pptp_ctrl.h ... handle PPTP control connection. 2 * C. Scott Ananian <cananian@alumni.princeton.edu> 3 * 4 * $Id: pptp_ctrl.h,v 1.5 2004/11/09 01:42:32 quozl Exp $ 5 */ 6 7#ifndef INC_PPTP_CTRL_H 8#define INC_PPTP_CTRL_H 9#include <sys/types.h> 10 11typedef struct PPTP_CONN PPTP_CONN; 12typedef struct PPTP_CALL PPTP_CALL; 13 14enum call_state { CALL_OPEN_RQST, CALL_OPEN_DONE, CALL_OPEN_FAIL, 15 CALL_CLOSE_RQST, CALL_CLOSE_DONE }; 16enum conn_state { CONN_OPEN_RQST, CONN_OPEN_DONE, CONN_OPEN_FAIL, 17 CONN_CLOSE_RQST, CONN_CLOSE_DONE }; 18 19typedef void (*pptp_call_cb)(PPTP_CONN*, PPTP_CALL*, enum call_state); 20typedef void (*pptp_conn_cb)(PPTP_CONN*, enum conn_state); 21 22/* if 'isclient' is true, then will send 'conn open' packet to other host. 23 * not necessary if this is being opened by a server process after 24 * receiving a conn_open packet from client. 25 */ 26PPTP_CONN * pptp_conn_open(int inet_sock, int isclient, 27 pptp_conn_cb callback); 28PPTP_CALL * pptp_call_open(PPTP_CONN * conn, int call_id, 29 pptp_call_cb callback, char *phonenr,int window); 30int pptp_conn_established(PPTP_CONN * conn); 31int pptp_conn_dead(PPTP_CONN *conn); 32/* soft close. Will callback on completion. */ 33void pptp_call_close(PPTP_CONN * conn, PPTP_CALL * call); 34/* hard close. */ 35void pptp_call_destroy(PPTP_CONN *conn, PPTP_CALL *call); 36/* soft close. Will callback on completion. */ 37void pptp_conn_close(PPTP_CONN * conn, u_int8_t close_reason); 38/* hard close */ 39void pptp_conn_destroy(PPTP_CONN * conn); 40void pptp_conn_free(PPTP_CONN * conn); 41 42/* Add file descriptors used by pptp to fd_set. */ 43void pptp_fd_set(PPTP_CONN * conn, fd_set * read_set, fd_set * write_set, int *max_fd); 44/* handle any pptp file descriptors set in fd_set, and clear them */ 45int pptp_dispatch(PPTP_CONN * conn, fd_set * read_set, fd_set * write_set); 46 47/* Get info about connection, call */ 48void pptp_call_get_ids(PPTP_CONN * conn, PPTP_CALL * call, 49 u_int16_t * call_id, u_int16_t * peer_call_id); 50/* Arbitrary user data about this call/connection. 51 * It is the caller's responsibility to free this data before calling 52 * pptp_call|conn_close() 53 */ 54void * pptp_conn_closure_get(PPTP_CONN * conn); 55void pptp_conn_closure_put(PPTP_CONN * conn, void *cl); 56void * pptp_call_closure_get(PPTP_CONN * conn, PPTP_CALL * call); 57void pptp_call_closure_put(PPTP_CONN * conn, PPTP_CALL * call, void *cl); 58 59#endif /* INC_PPTP_CTRL_H */ 60