---
name: "getrent"
section: "2"
platform: "linux"
package: "lam2-dev"
version: "6.3.2-3"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/getrent"
---

# getrent(2)

Get LAM route information.

## NAME

getrent, getrentc, getroute, getroute2, getrtype  - Get LAM route information.

## C SYNOPSIS

```
#include <net.h>
#include <rreq.h>
#include <events.h>
int getrent (struct route *rent);
int getrentc (struct route *rent);
int getroute (struct nmsg *nhead);
int getroute2 (struct nmsg *nhead);
int getrtype (int nodeid);
```

## FORTRAN SYNOPSIS

```
integer function IGRTP (nodeid)
integer nodeid
```

## DESCRIPTION

These functions return information obtained from the local route daemon, a modular component of the LAM daemon. *getrent()* and *getrentc()* accept a pointer to a route structure, defined in \<rreq.h\>:

```
	struct route {
		int	r_nodeid;
		int	r_event;
		int	r_link;
		int	r_event2;
		int	r_link2;
		int	r_nodetype;
	};
```

The structure fields hold the following information.

- r\_nodeid

  destination node ID

- r\_event

  forwarding event, representing the best suggested route to the destination node

- r\_link

  forwarding link associated with r\_event, if r\_event is a datalink output process

- r\_event2

  secondary forwarding event, representing a non-reconvergent route (primarily used for multicasting) with respect to other destinations

- r\_link2

  forwarding link associated with r\_event2, if r\_event2 is a datalink output process

- r\_nodetype

  node type of destination node (see [getntype(2)](/getntype/2.md))

*getrent()* sends a request for route information to the route daemon. The *r\_nodeid* field must be set by the caller to the nodeid of the destination node whose route table entry is required. All other fields are filled by the function.

*getrentc()* has the exact functionality of *getrent()*, except that it caches the recently accessed route table entries. Later access to the same entries are faster. *getrentc()* first checks the cache for the route entry of the given nodeid. If the entry is found, the requested information is returned. Otherwise, *getrent()* is called, returning a copy of the route table entry from the route daemon. This entry is then stored in the cache.

The remaining functions are wrappers for *getrentc()*. *getroute()* accepts a network message descriptor with the destination node and event fields set and fills in the forwarding fields. *getroute2()* is similar to *getroute()* except that the secondary routing information is used.

*getrtype()* accepts a node identifier and returns the type of that node.

## C RETURN VALUE

Upon successful completion of *getrent()*, *getrentc()*, *getroute()*, or *getroute2()*, 0 is returned. Otherwise, -1 is returned and global error variable *errno* is set accordingly. *getrtype()* returns a valid node type when successful. NOTNODETYPE (defined in \<net.h\>) is returned if an error occurs. When an error occurs, these functions set the global variable *errno* to the appropriate error code.

## FORTRAN RETURN VALUE

*IGRTP()* returns a valid node type when successful. NOTNODETYPE (see [CONSTANTS(5)](/CONSTANTS/5.md)) is returned if an error occurs.

## ERRORS

- EBADNODE

  The supplied node identifier does not exist.

## SEE ALSO

[getntype(2)](/getntype/2.md), [rrsetrents(2)](/rrsetrents/2.md), [CONSTANTS(5)](/CONSTANTS/5.md)
