linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* about option_t
@ 2008-05-05  7:34 cyx_mail
  2008-05-05 10:05 ` James Cameron
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cyx_mail @ 2008-05-05  7:34 UTC (permalink / raw)
  To: linux-ppp

typedef struct {
	char	*name;		/* name of the option */
	enum opt_type type;
	void	*addr;
	char	*description;
	unsigned int flags;
	void	*addr2;
	int	upper_limit;
	int	lower_limit;
	const char *source;
	short int priority;
	short int winner;
} option_t;

Which piece of code call the void *addr. some plugins uses this pointer to call functions when the plugin loads. BTW, what is the exactly meaning of each value of enum opt_type struct? Thanks a lot!

2008-05-05 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: about option_t
  2008-05-05  7:34 about option_t cyx_mail
@ 2008-05-05 10:05 ` James Cameron
  2008-05-05 11:39 ` James Carlson
  2008-05-05 12:43 ` cyx_mail
  2 siblings, 0 replies; 4+ messages in thread
From: James Cameron @ 2008-05-05 10:05 UTC (permalink / raw)
  To: linux-ppp

On Mon, May 05, 2008 at 03:34:29PM +0800, cyx_mail@foxmail.com wrote:
> Which piece of code call the void *addr. some plugins uses this
> pointer to call functions when the plugin loads. BTW, what is the
> exactly meaning of each value of enum opt_type struct? Thanks a lot!

Not an interesting question, sorry.  Refer to the PPP source.  It is
truly fascinating and well coded.  Explore references to the option_t
typedef.  Take particular note of ->addr and where o_bool appears in the
source.  It is amazing.  Truly, amazing.  Use a capable editor and cross
referencing tool.  I use emacs with etags, but you might find something
else more appropriate.

-- 
James Cameron

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: about option_t
  2008-05-05  7:34 about option_t cyx_mail
  2008-05-05 10:05 ` James Cameron
@ 2008-05-05 11:39 ` James Carlson
  2008-05-05 12:43 ` cyx_mail
  2 siblings, 0 replies; 4+ messages in thread
From: James Carlson @ 2008-05-05 11:39 UTC (permalink / raw)
  To: linux-ppp

cyx_mail@foxmail.com writes:
> Which piece of code call the void *addr.

'addr' is a type-dependent value.  It's not necessarily called as a
function -- that only happens if the type is o_special,
o_special_noarg, or o_wild.

> some plugins uses this pointer to call functions when the plugin loads. BTW, what is the exactly meaning of each value of enum opt_type struct? Thanks a lot!

The values should be relatively self-explanatory, if you read the code
in options.c or examine any of the code that uses the options.

  o_special_noarg - option is processed by a function call and
  consumes no other arguments.

  o_special - option processed by function call and consumes one more
  argument.

  o_bool - option address is a 'bool' to be set to the lower 8 bits of
  'flags'.  If 'addr2' is set, use the OPT_A2{COPY,CLR,CLRB,OR) to
  determine what is done to that value.

  o_int - parse an integer, offset by low 8 bits of 'flags', and store
  in 'addr'.

  o_wild - special self-identifying option (no keyword; parsed by
  appearance).  Used only for IPv4 addresses, device name, and tty
  speed.

-- 
James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: about option_t
  2008-05-05  7:34 about option_t cyx_mail
  2008-05-05 10:05 ` James Cameron
  2008-05-05 11:39 ` James Carlson
@ 2008-05-05 12:43 ` cyx_mail
  2 siblings, 0 replies; 4+ messages in thread
From: cyx_mail @ 2008-05-05 12:43 UTC (permalink / raw)
  To: linux-ppp

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 1536 bytes --]

thanks for you help!


2008-05-05 






·¢¼þÈË£º James Carlson 
·¢ËÍʱ¼ä£º 2008-05-05  19:41:21 
ÊÕ¼þÈË£º cyx_mail@foxmail.com 
³­ËÍ£º linux-ppp 
Ö÷Ì⣺ Re: about option_t 
 
cyx_mail@foxmail.com writes:
> Which piece of code call the void *addr.
'addr' is a type-dependent value.  It's not necessarily called as a
function -- that only happens if the type is o_special,
o_special_noarg, or o_wild.
> some plugins uses this pointer to call functions when the plugin loads. BTW, what is the exactly meaning of each value of enum opt_type struct? Thanks a lot!
The values should be relatively self-explanatory, if you read the code
in options.c or examine any of the code that uses the options.
  o_special_noarg - option is processed by a function call and
  consumes no other arguments.
  o_special - option processed by function call and consumes one more
  argument.
  o_bool - option address is a 'bool' to be set to the lower 8 bits of
  'flags'.  If 'addr2' is set, use the OPT_A2{COPY,CLR,CLRB,OR) to
  determine what is done to that value.
  o_int - parse an integer, offset by low 8 bits of 'flags', and store
  in 'addr'.
  o_wild - special self-identifying option (no keyword; parsed by
  appearance).  Used only for IPv4 addresses, device name, and tty
  speed.
-- 
__________ NOD32 3072 (20080503) Information __________
This message was checked by NOD32 antivirus system.
http://www.nod32cn.com
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þšiþ)í…æèw*\x1fjg¬±¨\x1e¶‰šŽŠÝ¢jÿ¾\a«þG«éÿ¢¸\f¢·¦j:+v‰¨ŠwèjØm¶Ÿÿþø\x1e¯ù\x1e®w¥þŠàþf£¢·hšâúÿ†Ù¥

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-05 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-05  7:34 about option_t cyx_mail
2008-05-05 10:05 ` James Cameron
2008-05-05 11:39 ` James Carlson
2008-05-05 12:43 ` cyx_mail

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).