From: James Carlson <carlsonj@workingcode.com>
To: linux-ppp@vger.kernel.org
Subject: Re: Using pppd as a library
Date: Tue, 14 Aug 2012 14:57:13 +0000 [thread overview]
Message-ID: <502A6749.3000007@workingcode.com> (raw)
In-Reply-To: <502A3A31.2050106@ibtechnology.com>
On 08/14/12 07:44, neha chatrath wrote:
> I have system requirement in which I need to invoke pppd from a user
> application. This user application needs to do configuration, get status
> etc of the PPP links.
> Well there are various ways of doing it, I am exploring the option of
> including pppd as a library in my build. With this,
> -I can spawn my application as a thread.
> -I can avoid use of fork and exec operations for executing pppd for
> different links.
You'll need to somehow deal with the event loop that handles both timers
and control path I/O. And you may also have to deal with blocking
operations, such as name service look-ups that occur during
configuration parsing, that the rest of your application may not be
expecting in a library.
It sounds like a non-trivial thing to get right, at least to me. (Of
course, it's probably possible to do it wrong with less effort. ;-})
Note also that the current code assumes that it's running in a single
process per PPP link. It's littered with statics and other things that
would need to be cleaned up if you were to make it useful for multiple
links in a single process.
I wouldn't do it this way. Instead, I would use some IPC mechanism to
get at the data necessary. Then it's just a matter of figuring out how
to get the IPC into the existing event loop (or go multi-threaded if you
dare). Suitable IPCs (UDP sockets, named pipes, Solaris Doors) will
vary depending on OS, and suitable protocols to use over the IPC will
also vary depending on the application. In some cases, it may make
sense to build an SNMP agent into the pppd code.
If fork+exec is expensive in your neighborhood (it certainly shouldn't
be, but I don't live where you do), then I think you have a long row to hoe.
> Can somebody help me with this. Is there any pppd library already
> available?
To my knowledge, it's never been done. When I was with a start-up many
years ago, I did modify the code so that it could handle multiple links
at once, because we scaled to many thousands of links, but I still did
the control and monitoring through an IPC. (No, I don't have that code
... it went with the start-up. :-<)
--
James Carlson 42.703N 71.076W <carlsonj@workingcode.com>
next prev parent reply other threads:[~2012-08-14 14:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 11:56 Using pppd as a library neha chatrath
2012-08-14 14:01 ` Charlie Brady
2012-08-14 14:29 ` Bill Unruh
2012-08-14 14:57 ` James Carlson [this message]
2012-08-15 6:20 ` Marcel Holtmann
2012-08-15 7:14 ` walter harms
2012-08-15 13:07 ` James Carlson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=502A6749.3000007@workingcode.com \
--to=carlsonj@workingcode.com \
--cc=linux-ppp@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.