external/ppp
Revision | 8ee7e4a55bdd79b5891e8f8326146639ef683935 (tree) |
---|---|
Zeit | 2009-05-08 15:34:29 |
Autor | Chia-chi Yeh <chiachi@andr...> |
Commiter | The Android Open Source Project |
am a263473: 1. Add a new option \'pppox <n>\' to support PPPoX sockets. No
Merge commit 'a263473d0d18736659607a8f2e178ee94cf3f989'
* commit 'a263473d0d18736659607a8f2e178ee94cf3f989':
@@ -13,7 +13,6 @@ LOCAL_SRC_FILES:= \ | ||
13 | 13 | chap-new.c \ |
14 | 14 | ccp.c \ |
15 | 15 | ecp.c \ |
16 | - ipxcp.c \ | |
17 | 16 | auth.c \ |
18 | 17 | options.c \ |
19 | 18 | sys-linux.c \ |
@@ -24,10 +23,11 @@ LOCAL_SRC_FILES:= \ | ||
24 | 23 | eap.c \ |
25 | 24 | chap-md5.c \ |
26 | 25 | pppcrypt.c \ |
27 | - openssl-hash.c | |
26 | + openssl-hash.c \ | |
27 | + pppox.c | |
28 | 28 | |
29 | 29 | LOCAL_SHARED_LIBRARIES := \ |
30 | - libcutils libcrypto libssl | |
30 | + libcutils libcrypto | |
31 | 31 | |
32 | 32 | LOCAL_C_INCLUDES := \ |
33 | 33 | $(LOCAL_PATH)/include |
@@ -360,13 +360,20 @@ main(argc, argv) | ||
360 | 360 | */ |
361 | 361 | tty_init(); |
362 | 362 | |
363 | +#ifdef ANDROID_CHANGES | |
364 | + { | |
365 | + extern void pppox_init(); | |
366 | + pppox_init(); | |
367 | + } | |
368 | +#endif | |
369 | + | |
363 | 370 | progname = *argv; |
364 | 371 | |
365 | 372 | /* |
366 | 373 | * Parse, in order, the system options file, the user's options file, |
367 | 374 | * and the command line arguments. |
368 | 375 | */ |
369 | -#ifdef ANDROID | |
376 | +#ifdef ANDROID_CHANGES | |
370 | 377 | /* Android: only take options from commandline */ |
371 | 378 | if (!parse_args(argc-1, argv+1)) |
372 | 379 | exit(EXIT_OPTION_ERROR); |
@@ -0,0 +1,67 @@ | ||
1 | +/* | |
2 | + * Copyright (C) 2009 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 <unistd.h> | |
18 | +#include "pppd.h" | |
19 | + | |
20 | +static int pppox_set(char **); | |
21 | +static int pppox_connect(); | |
22 | +static void pppox_disconnect(); | |
23 | + | |
24 | +static option_t pppox_options[] = { | |
25 | + {"pppox", o_special, pppox_set, "PPPoX socket", OPT_DEVNAM}, | |
26 | + {NULL}, | |
27 | +}; | |
28 | + | |
29 | +static struct channel pppox_channel = { | |
30 | + .options = pppox_options, | |
31 | + .process_extra_options = NULL, | |
32 | + .check_options = NULL, | |
33 | + .connect = pppox_connect, | |
34 | + .disconnect = pppox_disconnect, | |
35 | + .establish_ppp = generic_establish_ppp, | |
36 | + .disestablish_ppp = generic_disestablish_ppp, | |
37 | + .send_config = NULL, | |
38 | + .recv_config = NULL, | |
39 | + .cleanup = NULL, | |
40 | + .close = NULL, | |
41 | +}; | |
42 | + | |
43 | +static int pppox = -1; | |
44 | + | |
45 | +static int pppox_set(char **argv) { | |
46 | + if (!int_option(*argv, &pppox)) { | |
47 | + return 0; | |
48 | + } | |
49 | + info("Using PPPoX (socket = %d)", pppox); | |
50 | + the_channel = &pppox_channel; | |
51 | + return 1; | |
52 | +} | |
53 | + | |
54 | +static int pppox_connect() { | |
55 | + return pppox; | |
56 | +} | |
57 | + | |
58 | +static void pppox_disconnect() { | |
59 | + if (pppox != -1) { | |
60 | + close(pppox); | |
61 | + pppox = -1; | |
62 | + } | |
63 | +} | |
64 | + | |
65 | +void pppox_init() { | |
66 | + add_options(pppox_options); | |
67 | +} |