INET(3)

πŸ’– INET(3) β€” the AX25 address glow-up guide πŸ’–

okay bestie, so this is a page from the Linux Programmer's Manual, and it's literally all about the AX25 Address manipulation routines. yes, the same INET(3) you were looking for. sit down, hydrate, and let's get into it 🫢


✨ NAME ✨

ax25_aton, ax25_aton_entry, ax25_aton_arglist, ax25_ntoa, ax25_cmp, ax25_validate β€” AX25 Address manipulation routines

like… they manipulate AX25 addresses. that's the whole vibe. πŸ’…


✨ SYNOPSIS ✨

#include <netax25/ax25.h>

int ax25_aton(const char *cp, struct full_sockaddr_ax25 *fsap);

int ax25_aton_arglist(const char **cp, struct full_sockaddr_ax25 *fsap);

int ax25_aton_entry(const char *cp, char *axp);

char *ax25_ntoa(ax25_address *axp);

int ax25_cmp(ax25_address *ax1, ax25_address *ax2);

int ax25_validate(char *axp);

char *ax25_config_file(const char *filename);

seven function signatures. she's thorough. πŸ‘‘


✨ DESCRIPTION ✨

okay so let's go one by one, no skimming, i see you πŸ‘€

ax25_aton() takes the ASCII string cp that is in the format callsign [[V|VIA]callsign...] and stores it in fsap in network format.

ax25_aton_entry() takes the ASCII string of a callsign cp and stores it in network format in axp.

ax25_aton_arglist() takes a NULL terminated array of strings cp and stores it in fsap in network format.

ax25_ntoa() takes a network format address axp and returns the ASCII representation. and bestie, listen β€” the string is returned in a statically allocated buffer, which subsequent calls will overwrite. so if you're holding onto that pointer expecting it to stay cute forever… it will not. it's giving "rented, not owned." 😭 copy it if you need it.

ax25_cmp() compares the two ax25 addresses, ax1 and ax2, that are in network format, and figures out whether they are identical, differ only by their SSIDs, or are just straight up different. three-way vibe check. 🌈

ax25_validate() checks to see if the address axp in network format is a correctly formatted address. is she valid? is she formatted right? we find out. βœ…


✨ RETURN VALUE ✨

the receipts, in order πŸ’–

  • ax25_aton() and ax25_aton_arglist() return -1 if an error occurs, otherwise the length of the returned structure.
  • ax25_aton_entry() returns -1 if an error occurs, otherwise zero.
  • ax25_cmp() returns 0 if the two addresses are identical, 1 if they are different, or 2 if only the SSIDs are different.
  • ax25_validate() returns TRUE if the callsign is valid or FALSE if it is not.
lowkey memorize those ax25_cmp() numbers, bestie. 0 same, 1 different, 2 just the SSID being messy. iykyk ✨

✨ SEE ALSO ✨

ax25(4), netrom(4), rose(4) β€” go read those next, they're the supporting cast πŸ¦‹


and that's the whole page, no cap. this little masterpiece lives in the Linux Programmer's Manual and it's dated 2008-Feb-04. yeah, she's an older icon but she still ate. πŸ‘‘πŸ’…

stay valid, stay formatted, and always free your statically allocated buffers (jk you can't, just copy them). mwah. πŸ’–πŸŽ€πŸ¦‹πŸŒΈ