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