1 /*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "pppd.h"
18 #include <unistd.h>
19
20 char pppd_version[] = VERSION;
21
22 static struct channel pppopptp_channel;
23
24 /* Option variables */
25 static int pptp_socket = -1;
26
27 static option_t pppopptp_options[] =
28 {
29 { "pptp_socket", o_int, &pptp_socket, "PPTP socket FD", OPT_PRIO },
30 { NULL }
31 };
32
pptp_connect(void)33 static int pptp_connect(void)
34 {
35 info("Using PPPoPPTP (socket = %d)", pptp_socket);
36 return pptp_socket;
37 }
38
pptp_disconnect(void)39 static void pptp_disconnect(void)
40 {
41 if (pptp_socket != -1) {
42 close(pptp_socket);
43 pptp_socket = -1;
44 }
45 }
46
plugin_init(void)47 void plugin_init(void)
48 {
49 add_options(pppopptp_options);
50 the_channel = &pppopptp_channel;
51 }
52
53 static struct channel pppopptp_channel = {
54 .options = pppopptp_options,
55 .process_extra_options = NULL,
56 .check_options = NULL,
57 .connect = pptp_connect,
58 .disconnect = pptp_disconnect,
59 .establish_ppp = generic_establish_ppp,
60 .disestablish_ppp = generic_disestablish_ppp,
61 .send_config = NULL,
62 .recv_config = NULL,
63 .close = NULL,
64 .cleanup = NULL,
65 };
66