From 67d4c0b35c9708ad5d637bd868c76bc7bb99bf71 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 17 Jan 2006 10:48:22 +0000 Subject: Add support for dialup/telephone connections --- dund/dund.1 | 3 +++ dund/dund.h | 1 + dund/main.c | 11 +++++++++-- dund/sdp.c | 8 +++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dund/dund.1 b/dund/dund.1 index 895fc97a..09fb7f75 100644 --- a/dund/dund.1 +++ b/dund/dund.1 @@ -14,6 +14,9 @@ Show active DUN connections \fB\-\-listen\fR \fB\-s\fR Listen for DUN connections .TP +\fB\-\-dialup\fR \fB\-u\fR +Listen for dialup/telephone connections +.TP \fB\-\-connect\fR \fB\-c\fR Create DUN connection .TP diff --git a/dund/dund.h b/dund/dund.h index 5a9a116d..c8761dac 100644 --- a/dund/dund.h +++ b/dund/dund.h @@ -33,6 +33,7 @@ #define LANACCESS 0 #define MROUTER 1 #define ACTIVESYNC 2 +#define DIALUP 3 /* DUN functions */ int dun_init(void); diff --git a/dund/main.c b/dund/main.c index 4aedebd7..06055fde 100644 --- a/dund/main.c +++ b/dund/main.c @@ -398,10 +398,11 @@ static struct option main_lopts[] = { { "msdun", 2, 0, 'X' }, { "activesync", 0, 0, 'a' }, { "mrouter", 1, 0, 'm' }, + { "dialup", 1, 0, 'u' }, { 0, 0, 0, 0 } }; -static char main_sopts[] = "hsc:k:Kr:i:lnp::DQ::AESMP:C::P:Xa"; +static char main_sopts[] = "hsc:k:Kr:i:lnp::DQ::AESMP:C::P:Xam:u"; static char main_help[] = "Bluetooth LAP (LAN Access over PPP) daemon version " VERSION " \n" @@ -410,6 +411,7 @@ static char main_help[] = "Options:\n" "\t--show --list -l Show active LAP connections\n" "\t--listen -s Listen for LAP connections\n" + "\t--dialup -u Pretend to be a dialup/telephone\n" "\t--connect -c Create LAP connection\n" "\t--mrouter -m Create mRouter connection\n" "\t--search -Q[duration] Search and connect\n" @@ -539,6 +541,11 @@ int main(int argc, char **argv) type = MROUTER; break; + case 'u': + mode = LISTEN; + type = DIALUP; + break; + case 'h': default: printf(main_help); @@ -599,7 +606,7 @@ int main(int argc, char **argv) fd = open("/dev/null", O_RDWR); dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); close(fd); - + setsid(); chdir("/"); } diff --git a/dund/sdp.c b/dund/sdp.c index bf190422..f0ea08b5 100644 --- a/dund/sdp.c +++ b/dund/sdp.c @@ -98,6 +98,9 @@ int dun_sdp_register(bdaddr_t *device, uint8_t channel, int type) case ACTIVESYNC: sdp_uuid128_create(&dun, (void *) async_uuid); break; + case DIALUP: + sdp_uuid16_create(&dun, DIALUP_NET_SVCLASS_ID); + break; default: sdp_uuid16_create(&dun, LAN_ACCESS_SVCLASS_ID); break; @@ -106,7 +109,7 @@ int dun_sdp_register(bdaddr_t *device, uint8_t channel, int type) svclass = sdp_list_append(NULL, &dun); sdp_set_service_classes(record, svclass); - if (type == LANACCESS) { + if (type == LANACCESS || type == DIALUP) { sdp_uuid16_create(&profile[0].uuid, LAN_ACCESS_PROFILE_ID); profile[0].version = 0x0100; pfseq = sdp_list_append(NULL, &profile[0]); @@ -120,6 +123,9 @@ int dun_sdp_register(bdaddr_t *device, uint8_t channel, int type) case ACTIVESYNC: sdp_set_info_attr(record, "ActiveSync", NULL, NULL); break; + case DIALUP: + sdp_set_info_attr(record, "Dialup Networking", NULL, NULL); + break; default: sdp_set_info_attr(record, "LAN Access Point", NULL, NULL); break; -- cgit