* inet_addr Equivalent
@ 2003-03-23 7:32 shesha bhushan
2003-03-23 12:18 ` Michael Vergoz
2003-03-23 14:46 ` Prasad
0 siblings, 2 replies; 3+ messages in thread
From: shesha bhushan @ 2003-03-23 7:32 UTC (permalink / raw)
To: linux-kernel, kernelnewbies
Hi all,
IF i want to use the inet_addr in kernel modules, then how to use. What is
the equivalent function to this or which is the header file that I have to
include. If I include "arpa/inet.h" and compile as kernel module, I gives
whole bunch of errors.
So please help me how to convert doted IP address to unsigned long inside
kernel modules. All help is very mucg apperciated.
Tahnking You
Shesha
_________________________________________________________________
Get more buddies in your list. Win prizes http://messenger.msn.co.in/promo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: inet_addr Equivalent
2003-03-23 7:32 inet_addr Equivalent shesha bhushan
@ 2003-03-23 12:18 ` Michael Vergoz
2003-03-23 14:46 ` Prasad
1 sibling, 0 replies; 3+ messages in thread
From: Michael Vergoz @ 2003-03-23 12:18 UTC (permalink / raw)
To: shesha bhushan; +Cc: linux-kernel, kernelnewbies
Hi,
Look at :
/* Convert from presentation format of an Internet number in buffer
starting at CP to the binary network format and store result for
interface type AF in buffer starting at BUF. */
extern int inet_pton (int __af, __const char *__restrict __cp,
void *__restrict __buf) __THROW;
If it doesn't work look in the libc source code :)
regards,
Michael
On Sun, 23 Mar 2003 07:32:05 +0000
"shesha bhushan" <bhushan_vadulas@hotmail.com> wrote:
>
> Hi all,
>
> IF i want to use the inet_addr in kernel modules, then how to use. What is
> the equivalent function to this or which is the header file that I have to
> include. If I include "arpa/inet.h" and compile as kernel module, I gives
> whole bunch of errors.
>
> So please help me how to convert doted IP address to unsigned long inside
> kernel modules. All help is very mucg apperciated.
>
> Tahnking You
> Shesha
>
>
>
>
>
> _________________________________________________________________
> Get more buddies in your list. Win prizes http://messenger.msn.co.in/promo
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: inet_addr Equivalent
2003-03-23 7:32 inet_addr Equivalent shesha bhushan
2003-03-23 12:18 ` Michael Vergoz
@ 2003-03-23 14:46 ` Prasad
1 sibling, 0 replies; 3+ messages in thread
From: Prasad @ 2003-03-23 14:46 UTC (permalink / raw)
To: shesha bhushan; +Cc: linux-kernel, kernelnewbies
may be you can write your own function... I had my implementation that
works, it should for you too... just take a look at the bottom.
> IF i want to use the inet_addr in kernel modules, then how to use. What is
> the equivalent function to this or which is the header file that I have to
> include. If I include "arpa/inet.h" and compile as kernel module, I gives
> whole bunch of errors.
unsigned int inet_addr(char *str)
{
int a,b,c,d;
char arr[4];
sscanf(str,"%d.%d.%d.%d",&a,&b,&c,&d);
arr[0] = a; arr[1] = b; arr[2] = c; arr[3] = d;
return *(unsigned int*)arr;
}
Prasad.
--
Failure is not an option
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-03-23 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-23 7:32 inet_addr Equivalent shesha bhushan
2003-03-23 12:18 ` Michael Vergoz
2003-03-23 14:46 ` Prasad
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®