|
From: Mattias A. <mat...@us...> - 2001-05-15 12:13:07
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_ipa.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* when USE_IPASSIGN is defined in bt_conf.h, btd will try to connect
to IPA server. If this fails btd will continue just as USE_IPASSIGN
never was defined (before this change, it used to exit btd).
* some cleanup
The diff of the modified file(s):
--- bt_ipa.c 2001/04/11 12:54:52 1.3
+++ bt_ipa.c 2001/05/15 12:13:04 1.4
@@ -58,8 +58,6 @@
#include "bt_conf.h"
#include "bt_misc.h"
=20
-#ifdef USE_IPASSIGN
-
int ipa_open(void)
{
int ipa_fd;
@@ -153,5 +151,3 @@
syslog(LOG_INFO, " usingmasq: %d", set->usingmasq);
}
}
-
-#endif /* USE_IPASSIGN */
--- btd.c 2001/05/14 11:29:36 1.12
+++ btd.c 2001/05/15 12:13:04 1.13
@@ -148,14 +148,12 @@
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* IPA stuff */
=20
-#ifdef USE_IPASSIGN
static int ipa_fd =3D -1;
static struct ipa_msg *msg;
static unsigned char ipa_buf[256];
static int parse_ipa_response(struct ipa_msg *msg);
static int ipa_sendrequest(int line, unsigned char *bd,
unsigned short type);
-#endif
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* General BTD stuff */
@@ -164,20 +162,23 @@
#define MODEMEMULCMD "memul" /* change name !*/
#define PPPDCMD "pppd"
=20
+static int do_hwinit =3D 1; /* do vendor specific initialization */
+static int do_reset =3D 0; /* reset hw using I/O pins */
+
+static int ipa_available =3D 0; /* is set if IPA was successfully initiali=
zed */
+static int modem_emul =3D 1; /* default modem emulation is enabled */
+static int init_hw_speed =3D 0; /* not set */
=20
static char *physdev =3D DEFAULT_PHYS_DEV;
static char *speedstr =3D DEFAULT_SPEED;
-static int bt_cfd =3D -1; /* control tty for bt stack */
-
-static int btd_pid;
static char local_name[LOCAL_NAME_LENGTH+1]; /* 'friendly' name in HW modu=
le */
-static int do_hwinit =3D 1; /* do vendor specific initialization */
-static int do_reset =3D 0; /* reset hw using I/O pins */
-static int init_hw_speed =3D 0; /* not set */
-static int modem_emul =3D 1; /* default modem emulation is enabled */
+
+static int btd_pid =3D -1;
+static int sdpsrv_pid =3D 0;
+static int bt_cfd =3D -1; /* control tty for bt stack */
static int phys_fd =3D -1; /* physical device e.g ttyS0 */
static jmp_buf jmpbuffer; /* used to jump back in program after doing rese=
t */
-static int sdpsrv_pid =3D 0;
+
=20
/* long option list */
static struct option long_options[] =3D
@@ -308,9 +309,10 @@
tv.tv_usec =3D 0;
=20
FD_ZERO(&rfd);=20=20
-#ifdef USE_IPASSIGN
+
+ if (ipa_available)
FD_SET(ipa_fd, &rfd);
-#endif
+=20=20=20=20
FD_SET(0, &rfd);
=20
result =3D select(FD_SETSIZE, &rfd, NULL, NULL, &tv);
@@ -394,7 +396,8 @@
read_remote_bd(bt_cfd, PEER(line).remote_bd);
printf("Remote bd: %s\n", bd2str(PEER(line).remote_bd));
=20=20=20=20=20=20=20
-#ifdef USE_IPASSIGN
+ if (ipa_available)
+ {=20=20
D(syslog(LOG_INFO, "Sending IPA request\n"));
=20=20=20=20=20=20=20
PEER(line).ipset =3D &IPSET(line);
@@ -412,14 +415,16 @@
}
else
D(syslog(LOG_INFO, "IPA request sent"));
-#else
+ }
+ else /* No IPA server available */
+ {=20
STATE(line) =3D PPPCONF_DONE;
build_pppdopts(line, (char**)pppd_options);=20=20=20=20=20=20
start_pppd(line, speedstr, (char**)pppd_options);=20=20=20=20=20
-#endif=20=20
}
}
}
+}
=20
/* only server */
void build_pppdopts(int line, char **opts)
@@ -428,9 +433,8 @@
struct ip_set *ipset =3D PEER(line).ipset;
char local_ip[20];
=20
-#ifdef USE_IPASSIGN
+ if (ipa_available)
show_ipset(ipset, line);
-#endif
=20=20=20
D(syslog(LOG_INFO, "build_pppdopts\n"));
=20=20=20
@@ -698,7 +702,8 @@
=20=20=20=20=20
syslog(LOG_INFO, "PPP line %d was shutdown\n", line);
=20=20=20=20=20
-#ifdef USE_IPASSIGN
+ if (ipa_available)=20
+ {=20
STATE(line) =3D WAITING_RETURN_PPPCONF;
=20
if (ipa_sendrequest(line, (unsigned char *)&PEER(line).remote_bd,=20
@@ -709,9 +714,11 @@
will be discovered in timout */
STATE(line) =3D NOCONNECTION;=20=20=20=20
}
-#else
+ }
+ else
+ {
STATE(line) =3D NOCONNECTION;=20=20=20=20
-#endif=20=20=20=20
+ }
=20
PEER(line).ipset =3D NULL;
PEER(line).pppd_pid =3D -1;
@@ -759,7 +766,7 @@
=20
if (i > 8)
{=20=20
- exit(1);
+ break;
}
else
{
@@ -768,7 +775,12 @@
i *=3D 2;
}=20=20=20=20=20=20
}=20
+ else=20
+ {=20=20=20=20=20=20
+ syslog(LOG_INFO, "Found IPA server");
+ ipa_available =3D 1;
}=20
+ }=20
#endif
=20=20=20
if (modem_emul =3D=3D 1)
@@ -802,7 +814,6 @@
phys_fd =3D -1;
}
=20
-#ifdef USE_IPASSIGN
if (ipa_fd !=3D -1)
{
syslog(LOG_INFO, "closing IPA");
@@ -810,7 +821,7 @@
close(ipa_fd);
ipa_fd =3D -1;
}
-#endif=20
+
/* pid_fd is set if we created the pid file when we started */
if (btd_pid !=3D -1)
{
@@ -851,8 +862,6 @@
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* IPA stuff */
=20
-#ifdef USE_IPASSIGN
-
static int ipa_sendrequest(int line, unsigned char *bd, unsigned short typ=
e)
{
unsigned char buf[IPA_MSG_MAXSIZE];
@@ -942,6 +951,5 @@
}
return 0;
}
-#endif
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
|