IP Address Range Manager

Discussion in 'Java' started by miss, Aug 18, 2004.

  1. miss

    miss Guest

    I was wondering if there was any API out there to manage IPAddress. I
    already have implemented most of the part using string functions but
    it seems there should be better way to do this.

    I am storing IPAddress range in decimal format in the database. But
    user can put any of the following format.

    12.23.*.*
    12.23.21.23
    12.23.23.0-12.23.23.255
    216.239.32.0/19


    all of them gets converted to following format

    3639557888-3639558143
    miss, Aug 18, 2004
    #1
    1. Advertising

  2. miss

    Paul Lutus Guest

    miss wrote:

    > I was wondering if there was any API out there to manage IPAddress. I
    > already have implemented most of the part using string functions but
    > it seems there should be better way to do this.


    A better way to do what? You haven't said what your class needs to do. This
    makes giving advice rather difficult.

    > I am storing IPAddress range in decimal format in the database.


    Please spell out what you mean by "decimal format". Decimal strings?
    Integers?

    > But
    > user can put any of the following format.
    >
    > 12.23.*.*
    > 12.23.21.23
    > 12.23.23.0-12.23.23.255
    > 216.239.32.0/19
    >
    >
    > all of them gets converted to following format
    >
    > 3639557888-3639558143


    How does the first example in your list -- "12.23.*.*" get converted to a
    pair of integers? How do you handle this case and retain the originator's
    intentions?

    With answers to some of these questions, someone will be able to help you.

    --
    Paul Lutus
    http://www.arachnoid.com
    Paul Lutus, Aug 18, 2004
    #2
    1. Advertising

  3. miss

    zoopy Guest

    On 18-8-2004 23:43, miss wrote:

    > I was wondering if there was any API out there to manage IPAddress. I
    > already have implemented most of the part using string functions but
    > it seems there should be better way to do this.
    >
    > I am storing IPAddress range in decimal format in the database. But
    > user can put any of the following format.
    >
    > 12.23.*.*
    > 12.23.21.23
    > 12.23.23.0-12.23.23.255
    > 216.239.32.0/19
    >
    >
    > all of them gets converted to following format
    >
    > 3639557888-3639558143


    Maybe InetAddress and its subclasses?
    <http://java.sun.com/j2se/1.4.2/docs/api/java/net/InetAddress.html>

    --
    Regards,
    Z.
    zoopy, Aug 19, 2004
    #3
  4. miss

    miss Guest

    Thanks for the repsonse Paul.
    I am trying to have JSP form where users can put any number of IP
    ranges separated by comma. This format is same as access control list.
    The only difference is they will be stored in database as bigint in
    two different columns (fromIP to toIP).
    I don't think user will ever use the 12.23.*.* format, atleast
    12.23.23.* range will be entered.

    In that case, the range is 12.23.23.0-12.23.23.255 which will be
    converted to decimal range.

    Paul Lutus <> wrote in message news:<>...
    > miss wrote:
    >
    > > I was wondering if there was any API out there to manage IPAddress. I
    > > already have implemented most of the part using string functions but
    > > it seems there should be better way to do this.

    >
    > A better way to do what? You haven't said what your class needs to do. This
    > makes giving advice rather difficult.
    >
    > > I am storing IPAddress range in decimal format in the database.

    >
    > Please spell out what you mean by "decimal format". Decimal strings?
    > Integers?
    >
    > > But
    > > user can put any of the following format.
    > >
    > > 12.23.*.*
    > > 12.23.21.23
    > > 12.23.23.0-12.23.23.255
    > > 216.239.32.0/19
    > >
    > >
    > > all of them gets converted to following format
    > >
    > > 3639557888-3639558143

    >
    > How does the first example in your list -- "12.23.*.*" get converted to a
    > pair of integers? How do you handle this case and retain the originator's
    > intentions?
    >
    > With answers to some of these questions, someone will be able to help you.
    miss, Aug 19, 2004
    #4
  5. miss

    Paul Lutus Guest

    miss wrote:

    > Thanks for the repsonse Paul.
    > I am trying to have JSP form where users can put any number of IP
    > ranges separated by comma. This format is same as access control list.
    > The only difference is they will be stored in database as bigint in
    > two different columns (fromIP to toIP).


    BigInt? Isn't an int currently 32 bits? Isn't this the same as the size of
    an IP? I ask because there's no point in increasing the storage requirement
    across the board based on a misconception.

    In the case of ranges of addresses, you could use two integers and some code
    to interpret the meaning of zero fields. In fact, this might produce a more
    robust storage scheme than the alternatives.

    --
    Paul Lutus
    http://www.arachnoid.com
    Paul Lutus, Aug 19, 2004
    #5
  6. miss

    Liz Guest

    "Paul Lutus" <> wrote in message
    news:...
    > miss wrote:
    >
    > > Thanks for the repsonse Paul.
    > > I am trying to have JSP form where users can put any number of IP
    > > ranges separated by comma. This format is same as access control list.
    > > The only difference is they will be stored in database as bigint in
    > > two different columns (fromIP to toIP).

    >
    > BigInt? Isn't an int currently 32 bits? Isn't this the same as the size of
    > an IP? I ask because there's no point in increasing the storage

    requirement
    > across the board based on a misconception.


    Isn't IPV6 bigger? What about the mask?

    >
    > In the case of ranges of addresses, you could use two integers and some

    code
    > to interpret the meaning of zero fields. In fact, this might produce a

    more
    > robust storage scheme than the alternatives.
    >
    > --
    > Paul Lutus
    > http://www.arachnoid.com
    >
    Liz, Aug 20, 2004
    #6
  7. miss

    Paul Lutus Guest

    Liz wrote:

    >
    > "Paul Lutus" <> wrote in message
    > news:...
    >> miss wrote:
    >>
    >> > Thanks for the repsonse Paul.
    >> > I am trying to have JSP form where users can put any number of IP
    >> > ranges separated by comma. This format is same as access control list.
    >> > The only difference is they will be stored in database as bigint in
    >> > two different columns (fromIP to toIP).

    >>
    >> BigInt? Isn't an int currently 32 bits? Isn't this the same as the size
    >> of an IP? I ask because there's no point in increasing the storage

    > requirement
    >> across the board based on a misconception.

    >
    > Isn't IPV6 bigger? What about the mask?


    The OP hasn't addressed either IPV6 or a mask, so I decided not to address
    those either. In any case, BigInteger (if this is the OP's meaning) is more
    than is needed even for IPV6. I would create a class with appropriate
    integer data types for each requirement, and no more.

    --
    Paul Lutus
    http://www.arachnoid.com
    Paul Lutus, Aug 20, 2004
    #7
  8. miss

    Liz Guest

    "miss" <> wrote in message
    news:...
    > I was wondering if there was any API out there to manage IPAddress. I
    > already have implemented most of the part using string functions but
    > it seems there should be better way to do this.
    >
    > I am storing IPAddress range in decimal format in the database. But
    > user can put any of the following format.
    >
    > 12.23.*.*
    > 12.23.21.23
    > 12.23.23.0-12.23.23.255
    > 216.239.32.0/19
    >
    >
    > all of them gets converted to following format
    >
    > 3639557888-3639558143


    If YOU are MANAGING the IP addresses, why is the USER
    providing an IP address or range of IP addresses to you
    the MANAGER. I should think that YOU should select the
    IP address based on things like the LAN topology.
    Liz, Aug 20, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    46
    Views:
    946
    Antoon Pardon
    Jul 25, 2006
  2. padma
    Replies:
    0
    Views:
    334
    padma
    Oct 3, 2007
  3. Lambda
    Replies:
    2
    Views:
    381
    James Kanze
    Jul 16, 2008
  4. Metalone
    Replies:
    0
    Views:
    332
    Metalone
    Jan 6, 2010
  5. Tomoyuki Kosimizu

    Range does not take an Range object.

    Tomoyuki Kosimizu, Nov 25, 2003, in forum: Ruby
    Replies:
    3
    Views:
    137
    Tomoyuki Kosimizu
    Nov 27, 2003
Loading...

Share This Page