Start ppp connection from an application

I need to establish a ppp connection to a ppp server from an application.
Photon will not be present.

What is the best way of going about this as I am no expert in this field?

Francois

Francois Joubert <francois@truvelo.co.za> wrote in message
news:crg2ia$ird$1@inn.qnx.com

I need to establish a ppp connection to a ppp server from an application.
Photon will not be present.

What is the best way of going about this as I am no expert in this field?

Look at pppd, find out what options you will need, try it out on command
line. Once it works, call “spawnl()” in your program to spawn pppd.

-xtang

Xiaodan Tang wrote:

Francois Joubert <> francois@truvelo.co.za> > wrote in message
news:crg2ia$ird$> 1@inn.qnx.com> …

I need to establish a ppp connection to a ppp server from an application.
Photon will not be present.

What is the best way of going about this as I am no expert in this field?


Look at pppd, find out what options you will need, try it out on command
line. Once it works, call “spawnl()” in your program to spawn pppd.

-xtang


I have used modem_script to establish a connection with an ISP.

The script is:
struct modem_script scr_connect[] = {
/* Dial */
{ 1, 0, 1, 0, 2, 5,
0, NULL, “at”, “Response”},
{ 1, 0, 2, 0, 100, 5,
0, “ok”, dial, “Dial”},
{ 2, 0, 3, MODEM_LASTLINE, 100, 5,
0, “connect”, NULL, “Connect”},
{ 3, 0, 4, 0, 10, 5,
0, “*sername: *”, username, “Login”},
{ 4, MODEM_NOECHO, 5, 0, 10, 5,
0, "*assword: ", password, “Password”},
/
This may change what a successful response will be /
{ 5, 0, 0, 0, 30, 5,
0, “ppp”, NULL, “Hand over to pppd”},
/
Error states */
{ 0, 0, 0, 0, 0, 0,
1, “error”, NULL, “Error”},
{ 0, 0, 0, 0, 0, 0,
2, “no carrier”, NULL, “No carrier”},
{ 0, 0, 0, 0, 0, 0,
3, “no answer”, NULL, “No answer”},
{ 0, 0, 0, 0, 0, 0,
4, “no dialtone”,NULL, “No dialtone”},
{ 0, 0, 0, 0, 0, 0,
5, “busy”, NULL, “Busy”},
{ NULL }
};

I then spawn pppd with:
/usr/sbin/pppd $1 debug defaultroute +resconf require-ns noipdefault
logstatus nodetach receive-all +stdinsecret name $2 nameserver
196.25.1.1 nameserver 196.25.1.9 logfile pppd.log

This is the arguments phdialer use apart from ‘debug’ and ‘logfile’.

What the log file generate is:
Status print: PPPD Status: pppd Started
Using interface ppp0
Connect: ppp0 <–> /dev/ser8
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa8649172> ]
rcvd [LCP ConfReq id=0x97 <asyncmap 0xa0000> <magic
0x3d7f9083> ]
sent [LCP ConfAck id=0x97 <asyncmap 0xa0000> <magic
0x3d7f9083> ]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xa8649172> ]

What ifconfig say is:

ifconfig

lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 33212
capabilities=7<IP4CSUM,TCP4CSUM,UDP4CSUM>
enabled=0<>
inet 127.0.0.1 netmask 0xff000000
en0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
address: 00:07:b8:00:19:e3
inet 192.168.11.175 netmask 0xffffff00 broadcast 192.168.11.255
ppp0: flags=8050<POINTOPOINT,RUNNING,MULTICAST> mtu 1500

Therefore no connection.

Why does phdialer do different from what I do?

Francois

phdialer knows a lot more about pppd, and other then simply “spawn” the
pppd with those options, it also set up pipes and such with pppd.

You want to get rid of “+stdinsecret” and prepare your /etc/ppp/pap.secrets

-xtang


fj <sommerfj@webmail.co.za> wrote in message
news:cvusq9$87c$1@inn.qnx.com

Xiaodan Tang wrote:
Francois Joubert <> francois@truvelo.co.za> > wrote in message
news:crg2ia$ird$> 1@inn.qnx.com> …

I need to establish a ppp connection to a ppp server from an
application.
Photon will not be present.

What is the best way of going about this as I am no expert in this
field?


Look at pppd, find out what options you will need, try it out on command
line. Once it works, call “spawnl()” in your program to spawn pppd.

-xtang


I have used modem_script to establish a connection with an ISP.

The script is:
struct modem_script scr_connect[] = {
/* Dial */
{ 1, 0, 1, 0, 2, 5,
0, NULL, “at”, “Response”},
{ 1, 0, 2, 0, 100, 5,
0, “ok”, dial, “Dial”},
{ 2, 0, 3, MODEM_LASTLINE, 100, 5,
0, “connect”, NULL, “Connect”},
{ 3, 0, 4, 0, 10, 5,
0, “*sername: *”, username, “Login”},
{ 4, MODEM_NOECHO, 5, 0, 10, 5,
0, "*assword: ", password, “Password”},
/
This may change what a successful response will be /
{ 5, 0, 0, 0, 30, 5,
0, “ppp”, NULL, “Hand over to pppd”},
/
Error states */
{ 0, 0, 0, 0, 0, 0,
1, “error”, NULL, “Error”},
{ 0, 0, 0, 0, 0, 0,
2, “no carrier”, NULL, “No carrier”},
{ 0, 0, 0, 0, 0, 0,
3, “no answer”, NULL, “No answer”},
{ 0, 0, 0, 0, 0, 0,
4, “no dialtone”,NULL, “No dialtone”},
{ 0, 0, 0, 0, 0, 0,
5, “busy”, NULL, “Busy”},
{ NULL }
};

I then spawn pppd with:
/usr/sbin/pppd $1 debug defaultroute +resconf require-ns noipdefault
logstatus nodetach receive-all +stdinsecret name $2 nameserver
196.25.1.1 nameserver 196.25.1.9 logfile pppd.log

This is the arguments phdialer use apart from ‘debug’ and ‘logfile’.

What the log file generate is:
Status print: PPPD Status: pppd Started
Using interface ppp0
Connect: ppp0 <–> /dev/ser8
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa8649172> ]
rcvd [LCP ConfReq id=0x97 <asyncmap 0xa0000> <magic
0x3d7f9083> ]
sent [LCP ConfAck id=0x97 <asyncmap 0xa0000> <magic
0x3d7f9083> ]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xa8649172> ]

What ifconfig say is:

ifconfig

lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 33212
capabilities=7<IP4CSUM,TCP4CSUM,UDP4CSUM
enabled=0
inet 127.0.0.1 netmask 0xff000000
en0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
address: 00:07:b8:00:19:e3
inet 192.168.11.175 netmask 0xffffff00 broadcast 192.168.11.255
ppp0: flags=8050<POINTOPOINT,RUNNING,MULTICAST> mtu 1500

Therefore no connection.

Why does phdialer do different from what I do?

Francois