cidr.cpp revision d0919fc17582396c6254a3e3e517cccf886dd051
af062818b47340eef15700d2f0211576ba3506eevboxsync * IPRT - IPv4 address parsing.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (C) 2006-2008 Sun Microsystems, Inc.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
af062818b47340eef15700d2f0211576ba3506eevboxsync * available from http://www.virtualbox.org. This file is free software;
af062818b47340eef15700d2f0211576ba3506eevboxsync * you can redistribute it and/or modify it under the terms of the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * General Public License (GPL) as published by the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
af062818b47340eef15700d2f0211576ba3506eevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
af062818b47340eef15700d2f0211576ba3506eevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
af062818b47340eef15700d2f0211576ba3506eevboxsync * The contents of this file may alternatively be used under the terms
af062818b47340eef15700d2f0211576ba3506eevboxsync * of the Common Development and Distribution License Version 1.0
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * VirtualBox OSE distribution, in which case the provisions of the
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * CDDL are applicable instead of those of the GPL.
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * You may elect to license modified versions of this file under the
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * terms and conditions of either the GPL or the CDDL or both.
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
af062818b47340eef15700d2f0211576ba3506eevboxsync * additional information or have any questions.
af062818b47340eef15700d2f0211576ba3506eevboxsync/*******************************************************************************
af062818b47340eef15700d2f0211576ba3506eevboxsync* Header Files *
af062818b47340eef15700d2f0211576ba3506eevboxsync*******************************************************************************/
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * Scan a digit of an IPv4 address.
af062818b47340eef15700d2f0211576ba3506eevboxsync * @returns IPRT status code.
af062818b47340eef15700d2f0211576ba3506eevboxsync * @param iDigit The index of the IPv4 digit to scan.
af062818b47340eef15700d2f0211576ba3506eevboxsync * @param psz Pointer to the begin of the string.
af062818b47340eef15700d2f0211576ba3506eevboxsync * @param ppszNext Pointer to variable that should be set pointing to the first invalid character. (output)
af062818b47340eef15700d2f0211576ba3506eevboxsync * @param pu8 Pointer to the digit to write (output).
af062818b47340eef15700d2f0211576ba3506eevboxsyncstatic int scanIPv4Digit(int iDigit, const char *psz, char **ppszNext, uint8_t *pu8)
af062818b47340eef15700d2f0211576ba3506eevboxsync /* first digit cannot be 0 */
af062818b47340eef15700d2f0211576ba3506eevboxsyncint RTCidrStrToIPv4(const char *pszAddress, PRTIPV4ADDR pNetwork, PRTIPV4ADDR pNetmask)
af062818b47340eef15700d2f0211576ba3506eevboxsync /* 1st digit */
return rc;
return rc;
return rc;
return VERR_INVALID_PARAMETER;
cBits = 0;
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;