1 /* pptp_ctrl.h ... handle PPTP control connection.
2 * C. Scott Ananian <cananian@alumni.princeton.edu>
4 * $Id: pptp_ctrl.h,v 1.1.1.1 2002/07/25 06:52:39 honor Exp $
7 #ifndef INC_PPTP_CTRL_H
8 #define INC_PPTP_CTRL_H
11 typedef struct PPTP_CONN PPTP_CONN
;
12 typedef struct PPTP_CALL PPTP_CALL
;
14 enum call_state
{ CALL_OPEN_RQST
, CALL_OPEN_DONE
, CALL_OPEN_FAIL
,
15 CALL_CLOSE_RQST
, CALL_CLOSE_DONE
};
16 enum conn_state
{ CONN_OPEN_RQST
, CONN_OPEN_DONE
, CONN_OPEN_FAIL
,
17 CONN_CLOSE_RQST
, CONN_CLOSE_DONE
};
19 typedef void (*pptp_call_cb
)(PPTP_CONN
*, PPTP_CALL
*, enum call_state
);
20 typedef void (*pptp_conn_cb
)(PPTP_CONN
*, enum conn_state
);
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.
26 PPTP_CONN
* pptp_conn_open(int inet_sock
, int isclient
,
27 pptp_conn_cb callback
);
28 PPTP_CALL
* pptp_call_open(PPTP_CONN
* conn
,
29 pptp_call_cb callback
, char *phonenr
);
30 /* soft close. Will callback on completion. */
31 void pptp_call_close(PPTP_CONN
* conn
, PPTP_CALL
* call
);
33 void pptp_call_destroy(PPTP_CONN
*conn
, PPTP_CALL
*call
);
34 /* soft close. Will callback on completion. */
35 void pptp_conn_close(PPTP_CONN
* conn
, u_int8_t close_reason
);
37 void pptp_conn_destroy(PPTP_CONN
* conn
);
39 /* Add file descriptors used by pptp to fd_set. */
40 void pptp_fd_set(PPTP_CONN
* conn
, fd_set
* read_set
, fd_set
* write_set
, int *max_fd
);
41 /* handle any pptp file descriptors set in fd_set, and clear them */
42 void pptp_dispatch(PPTP_CONN
* conn
, fd_set
* read_set
, fd_set
* write_set
);
44 /* Get info about connection, call */
45 void pptp_call_get_ids(PPTP_CONN
* conn
, PPTP_CALL
* call
,
46 u_int16_t
* call_id
, u_int16_t
* peer_call_id
);
47 /* Arbitrary user data about this call/connection.
48 * It is the caller's responsibility to free this data before calling
49 * pptp_call|conn_close()
51 void * pptp_conn_closure_get(PPTP_CONN
* conn
);
52 void pptp_conn_closure_put(PPTP_CONN
* conn
, void *cl
);
53 void * pptp_call_closure_get(PPTP_CONN
* conn
, PPTP_CALL
* call
);
54 void pptp_call_closure_put(PPTP_CONN
* conn
, PPTP_CALL
* call
, void *cl
);
56 #endif /* INC_PPTP_CTRL_H */