GETNODEBYADDR(3)

πŸ“¦ version 2.65build2, in ubuntu jammy

πŸ’– GETNODEBYADDR(3) πŸ’–

okay bestie, welcome to the DECnet corner of the manual β€” this one lives in section 3 of the Library Functions Manual, and it's all about looking up a DECnet node when all you've got is its address. no cap, it's a little bop. πŸ¦‹


✨ NAME ✨

getnodebyaddr β€” DECnet node entry retrieval by address πŸ‘‘


🌸 SYNOPSIS 🌸

#include <netdnet/dn.h>
#include <netdnet/dnetdb.h>

struct nodeent *getnodebyaddr (char *addr, short len, const int family)

πŸ’… DESCRIPTION πŸ’…

so getnodebyaddr goes digging through the decnet hosts file looking for the DECnet node whose address equals addr and is len bytes long, belonging to protocol family family (that's PF_DECnet, babes). when it finds the one, it hands you back the node info all cozy inside the nodeent structure. πŸŽ€

and if there's literally no entry matching? it returns NULL. that's it. that's the whole vibe check. πŸ’€


πŸ”₯ EXAMPLE πŸ”₯

here's how the girlies actually call it:

#include <netdnet/dn.h>
#include <netdnet/dnetdb.h>
#include <sys/socket.h>

main(void)
{
    struct dn_naddr          binaddr;
    struct nodeent      *dp;

    binaddr->a_len = 2;
    binaddr->a_addr[0] = 0x02;
    binaddr->a_addr[1] = 0x04;

    if ( (dp=getnodebyaddr(binaddr->a_addr,binaddr->len, PF_DECnet)) == NULL)
        printf("Error, cannot find node entry");
    else
        printf("Node name is %s",dp->n_name);
}

like, if it comes back NULL you print the error, and if it doesn't you get the node name. main character energy fr fr. ✨


🫢 SEE ALSO 🫢


DECnet database functions 🌈 July 28, 1998 β€” yeah she's vintage, she's from the DECnet database functions era, and honestly? iconic. mwah πŸ’‹ go look up some nodes bestie πŸ’œ

πŸ“¦ where this page comes from