VxWorks API Reference : OS Libraries

remLib

NAME

remLib - remote command library

ROUTINES

rcmd( ) - execute a shell command on a remote machine
rresvport( ) - open a socket with a privileged port bound to it
remCurIdGet( ) - get the current user name and password
remCurIdSet( ) - set the remote user name and password
iam( ) - set the remote user name and password
whoami( ) - display the current remote identity
bindresvport( ) - bind a socket to a privileged IP port

DESCRIPTION

This library provides routines that support remote command functions. The rcmd( ) and rresvport( ) routines use protocols implemented in BSD 4.3; they support remote command execution, and the opening of a socket with a bound privileged port, respectively. For more information, see Unix Network Programming by W. Richard Stevens. This library also includes routines that authorize network file access via netDrv.

To include remLib in a VxWorks image, include the NETWRS_REMLIB configuration component. This component contains one parameter, RSH_STDERR_SETUP_TIMEOUT. Use this parameter to specify how long an rcmd( ) call should wait for a return from its internal call to select( ). Valid values for RSH_STDERR_SETUP_TIMEOUT are 0 (NO_WAIT), -1 (WAIT_FOREVER), or a positive integer from 1 to 2147483647 inclusive. This positive integer specifies the wait in seconds. The default value for RSH_STDERR_SETUP_TIMEOUT is -1 (WAIT_FOREVER).

INCLUDE FILES

remLib.h

SEE ALSO

inetLib


OS Libraries : Routines

rcmd( )

NAME

rcmd( ) - execute a shell command on a remote machine

SYNOPSIS

int rcmd
    (
    char * host,              /* host name or inet address */
    int    remotePort,        /* remote port to connect to (rshd) */
    char * localUser,         /* local user name */
    char * remoteUser,        /* remote user name */
    char * cmd,               /* command */
    int *  fd2p               /* if this pointer is non-zero, stderr */
                              /* socket is opened and socket descriptor is */
                              /* filled in */ 
    )

DESCRIPTION

This routine uses a remote shell daemon, rshd, to execute a command on a remote system. It is analogous to the BSD rcmd( ) routine.

Internally, this rcmd( ) implementation uses a select( ) call to wait for a response from the rshd daemon. If rcmd( ) receives a response within its timeout, rcmd( ) calls accept( ) and completes by returning a socket descriptor for the data generated on the remote machine.

The default timeout lets the rcmd( ) call wait forever. However, you can change the timeout value using the RSH_STDERR_SETUP_TIMEOUT parameter associated with the NETWRS_REMLIB configuration component.

RETURNS

A socket descriptor if the remote shell daemon accepts, or ERROR if the remote command fails.

S_remLib_RSH_ERROR, S_remLib_RSH_STDERR_SETUP_FAILED

SEE ALSO

remLib, BSD reference entry for rcmd( )


OS Libraries : Routines

rresvport( )

NAME

rresvport( ) - open a socket with a privileged port bound to it

SYNOPSIS

int rresvport
    (
    int * alport              /* port number to initially try */
    )

DESCRIPTION

This routine opens a socket with a privileged port bound to it. It is analogous to the UNIX routine rresvport( ).

RETURNS

A socket descriptor, or ERROR if either the socket cannot be opened or all ports are in use.

SEE ALSO

remLib, UNIX BSD 4.3 manual entry for rresvport( )


OS Libraries : Routines

remCurIdGet( )

NAME

remCurIdGet( ) - get the current user name and password

SYNOPSIS

void remCurIdGet
    (
    char * user,              /* where to return current user name */
    char * passwd             /* where to return current password */
    )

DESCRIPTION

This routine gets the user name and password currently used for remote host access privileges and copies them to user and passwd. Either parameter can be initialized to NULL, and the corresponding item will not be passed.

RETURNS

N/A

SEE ALSO

remLib, iam( ), whoami( )


OS Libraries : Routines

remCurIdSet( )

NAME

remCurIdSet( ) - set the remote user name and password

SYNOPSIS

STATUS remCurIdSet
    (
    char * newUser,           /* user name to use on remote */
    char * newPasswd          /* password to use on remote (NULL = none) */
    )

DESCRIPTION

This routine specifies the user name that will have access privileges on the remote machine. The user name must exist in the remote machine's /etc/passwd, and if it has been assigned a password, the password must be specified in newPasswd.

Either parameter can be NULL, and the corresponding item will not be set.

The maximum length of the user name and the password is MAX_IDENTITY_LEN (defined in remLib.h).

NOTE

A more convenient version of this routine is iam( ), which is intended to be used from the shell.

RETURNS

OK, or ERROR if the name or password is too long.

SEE ALSO

remLib, iam( ), whoami( )


OS Libraries : Routines

iam( )

NAME

iam( ) - set the remote user name and password

SYNOPSIS

STATUS iam
    (
    char * newUser,           /* user name to use on remote */
    char * newPasswd          /* password to use on remote (NULL = none) */
    )

DESCRIPTION

This routine specifies the user name that will have access privileges on the remote machine. The user name must exist in the remote machine's /etc/passwd, and if it has been assigned a password, the password must be specified in newPasswd.

Either parameter can be NULL, and the corresponding item will not be set.

The maximum length of the user name and the password is MAX_IDENTITY_LEN (defined in remLib.h).

NOTE

This routine is a more convenient version of remCurIdSet( ) and is intended to be used from the shell.

RETURNS

OK, or ERROR if the call fails.

SEE ALSO

remLib, whoami( ), remCurIdGet( ), remCurIdSet( )


OS Libraries : Routines

whoami( )

NAME

whoami( ) - display the current remote identity

SYNOPSIS

void whoami (void)

DESCRIPTION

This routine displays the user name currently used for remote machine access. The user name is set with iam( ) or remCurIdSet( ).

RETURNS

N/A

SEE ALSO

remLib, iam( ), remCurIdGet( ), remCurIdSet( )


OS Libraries : Routines

bindresvport( )

NAME

bindresvport( ) - bind a socket to a privileged IP port

SYNOPSIS

STATUS bindresvport
    (
    int                  sd,  /* socket to be bound */
    struct sockaddr_in * sin  /* socket address -- value/result */
    )

DESCRIPTION

This routine picks a port number between 600 and 1023 that is not being used by any other programs and binds the socket passed as sd to that port. Privileged IP ports (numbers between and including 0 and 1023) are reserved for privileged programs.

RETURNS

OK, or ERROR if the address family specified in sin is not supported or the call fails.

SEE ALSO

remLib