Skip to content

API network

JoungKyun Kim edited this page Jul 13, 2016 · 3 revisions

NAME

network - retuns network address for ip address and network mask

SYNOPSIS

#include <ipcalc.h>

unsigned long network (ulong ip, ulong mask)

DESCRIPTION

network api retuns network address that is caculated by given ip address and network mask.

RETURN VALUE

return 32 bit positive integer on success, and returns 0 on fails.

EXAMPLE

#include <ipcalc.h>

int main (void) {
    char * ip = "192.168.10.131";
    char * mask = "255.255.255.192";
    ulong r;

    r = network (ip2long (ip), ip2long (mask));
    printf ("NETWORK ADDRESS: %s\n", long2ip (r));

    return 0;
}

AUTHORS

JoungKyun.Kim <http://oops.org>

BUGS

Report to https://github.com/Joungkyun/libipcalc/issues

COPYRIGHT

Copyright (c) 2016 JoungKyun.Kim <http://oops.org>

This api is follows LGPL 2.1

SEE ALSO

broadcast(3), ip2long(3), long2ip(3)

Clone this wiki locally