YAddHost(3) Y host access list adding

SYNTAX

#include <Y2/Y.h>
#include <Y2/Ylib.h>

int YAddHost(

        YConnection *connection,

        YIPUnion *ip
)

ARGUMENTS

connection
Specifies the connection to the Y server, obtained by a call to YOpenConnection.
ip
Specifies the ip address of the host machine. See YIPUnion for more information about this structure.

DESCRIPTION

The YAddHost function adds the specified IP address ip to the Y server's list of allowed hosts.

RETURN VALUE

The YAddHost function returns 0 on success or -1 on failure.

EXAMPLE

#include <stdio.h>
#include <Y2/Y.h>
#include <Y2/Ylib.h>

int main(int argc, char *argv[])
{

        YIPUnion ip;

        YConnection *con = YOpenConnection(

                "/usr/sbin/starty",

                "127.0.0.1:9433"

        );

        if(con == NULL)

                return(1);


        /* 207.200.89.225 */

        ip.charaddr[0] = 207;

        ip.charaddr[1] = 200;

        ip.charaddr[2] = 89;

        ip.charaddr[3] = 225;

        if(YAddHost(con, &ip))

                printf("Error.\n");

        else

                printf("Success!\n");


        YCloseConnection(con, False);


        return(0);
}