---
name: "loc_database_lookup"
section: "3"
platform: "linux"
package: "libloc"
version: "0.9.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/loc_database_lookup"
---

# loc\_database\_lookup(3)

Lookup a network from the database

## NAME

loc\_database\_lookup - Lookup a network from the database

## SYNOPSIS

\#include \<libloc/database.h\>

int loc\_database\_lookup(struct loc\_database\* db, const struct in6\_addr\* address, struct loc\_network\*\* network);

int loc\_database\_lookup\_from\_string(struct loc\_database\* db, const char\* string, struct loc\_network\*\* network);

## DESCRIPTION

The lookup functions try finding a network in the database.

*loc\_database\_lookup* takes the IP address as *struct in6\_addr* format which can either be a regular IPv6 address or a mapped IPv4 address.

*loc\_database\_lookup\_string* takes the IP address as string and will parse it automatically.

## RETURN VALUE

On success, zero is returned. Otherwise non-zero is being returned and *errno* is set accordingly.

## SEE ALSO

[**libloc**(3)](/libloc/3.md)

## AUTHORS

Michael Tremer
