1 /* pptp_ctrl.h ... handle PPTP control connection.
2 * C. Scott Ananian <cananian@alumni.princeton.edu>
4 * $Id: pptp_ctrl.h,v 1.5 2004/11/09 01:42:32 quozl 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 int pptp_conn_established(PPTP_CONN
* conn
);
31 /* soft close. Will callback on completion. */
32 void pptp_call_close(PPTP_CONN
* conn
, PPTP_CALL
* call
);
34 void pptp_call_destroy(PPTP_CONN
*conn
, PPTP_CALL
*call
);
35 /* soft close. Will callback on completion. */
36 void pptp_conn_close(PPTP_CONN
* conn
, u_int8_t close_reason
);
38 void pptp_conn_destroy(PPTP_CONN
* conn
);
40 /* Add file descriptors used by pptp to fd_set. */
41 void pptp_fd_set(PPTP_CONN
* conn
, fd_set
* read_set
, fd_set
* write_set
, int *max_fd
);
42 /* handle any pptp file descriptors set in fd_set, and clear them */
43 int pptp_dispatch(PPTP_CONN
* conn
, fd_set
* read_set
, fd_set
* write_set
);
45 /* Get info about connection, call */
46 void pptp_call_get_ids(PPTP_CONN
* conn
, PPTP_CALL
* call
,
47 u_int16_t
* call_id
, u_int16_t
* peer_call_id
);
48 /* Arbitrary user data about this call/connection.
49 * It is the caller's responsibility to free this data before calling
50 * pptp_call|conn_close()
52 void * pptp_conn_closure_get(PPTP_CONN
* conn
);
53 void pptp_conn_closure_put(PPTP_CONN
* conn
, void *cl
);
54 void * pptp_call_closure_get(PPTP_CONN
* conn
, PPTP_CALL
* call
);
55 void pptp_call_closure_put(PPTP_CONN
* conn
, PPTP_CALL
* call
, void *cl
);
57 #endif /* INC_PPTP_CTRL_H */