The cl-maxminddb Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-maxminddb Reference Manual

This is the cl-maxminddb Reference Manual, version 0.0.1.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:48:47 2022 GMT+0.

Table of Contents


1 Introduction

CL-MAXMINDDB

Description

CL-MAXMINDDB is MaxMind DB files reader.

Usage

> (with-mmdb (mmdb "/var/lib/GeoIP/GeoLite2-City.mmdb")
    (mmdb-query mmdb "8.8.8.8"))

((:CONTINENT (:CODE . "NA") (:GEONAME-ID . 6255149)
  (:NAMES (:DE . "Nordamerika") (:EN . "North America") (:ES . "Norteamérica")
   (:FR . "Amérique du Nord") (:JA . "北アメリカ") (:PT-BR . "América do Norte")
   (:RU . "Северная Америка") (:ZH-CN . "北美洲")))
 (:COUNTRY (:GEONAME-ID . 6252001) (:ISO-CODE . "US")
  (:NAMES (:DE . "USA") (:EN . "United States") (:ES . "Estados Unidos")
   (:FR . "États-Unis") (:JA . "アメリカ合衆国") (:PT-BR . "Estados Unidos")
   (:RU . "США") (:ZH-CN . "美国")))
 (:LOCATION (:ACCURACY-RADIUS . 1000) (:LATITUDE . 37.751d0)
  (:LONGITUDE . -97.822d0) (:TIME-ZONE . "America/Chicago"))
 (:REGISTERED-COUNTRY (:GEONAME-ID . 6252001) (:ISO-CODE . "US")
  (:NAMES (:DE . "USA") (:EN . "United States") (:ES . "Estados Unidos")
   (:FR . "États-Unis") (:JA . "アメリカ合衆国") (:PT-BR . "Estados Unidos")
   (:RU . "США") (:ZH-CN . "美国"))))

That sets up a new database every time, which is fine for occasional lookups. If you need to do many lookups, the following approach is faster and produces the same result as above:

(defparameter *city-db* (make-mmdb "/var/lib/GeoIP/GeoLite2-City.mmdb"))
(mmdb-query *city-db* "8.8.8.8")

The first approach constructs a new database object, including an mmap of the Maxmind file, and unmaps it with each call. This is slower but doesn't keep the mmap in memory.

The second approach mmaps the file, keeps a permanent reference to the database object, and never unmaps it. This uses more memo


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-maxminddb

CL MaxMind DB

Author

Azamat S. Kalimoulline <turtle@bazon.ru>

License

GNU Lesser General Public License, v3

Version

0.0.1.3

Dependencies
  • babel (system).
  • cffi (system).
  • cffi-libffi (system).
  • ieee-floats (system).
  • iterate (system).
  • metabang-bind (system).
  • mmap (system).
Source

cl-maxminddb.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 cl-maxminddb/src

Source

cl-maxminddb.asd.

Parent Component

cl-maxminddb (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

4.1.1 cl-maxminddb/cl-maxminddb.asd

Source

cl-maxminddb.asd.

Parent Component

cl-maxminddb (system).

ASDF Systems

cl-maxminddb.


4.1.2 cl-maxminddb/src/package.lisp

Source

cl-maxminddb.asd.

Parent Component

src (module).

Packages

ru.bazon.cl-maxminddb.


4.1.3 cl-maxminddb/src/ip.lisp

Dependency

package.lisp (file).

Source

cl-maxminddb.asd.

Parent Component

src (module).

Internals

4.1.4 cl-maxminddb/src/maxminddb.lisp

Dependencies
Source

cl-maxminddb.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 ru.bazon.cl-maxminddb

Source

package.lisp.

Nickname

cl-maxminddb

Use List
  • babel.
  • cffi.
  • common-lisp.
  • ieee-floats.
  • iterate.
  • metabang.bind.
  • mmap.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Public Interface


6.1.1 Macros

Macro: with-mmdb ((mmdb file) &body body)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.


Previous: , Up: Public Interface   [Contents][Index]

6.1.2 Ordinary functions

Function: get-in (ip-record &rest path)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: make-mmdb (file)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mmdb-query (mmdb ip-string)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.


6.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.1 Special variables

Special Variable: *metadata-marker*
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.2 Ordinary functions

Function: binary-128 (number)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: binary-32 (number)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: binary-list (number num-of-bits)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: char->number (char)
Package

ru.bazon.cl-maxminddb.

Source

ip.lisp.

Function: copy-maxmind-database (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: copy-maxmind-database-metadata (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: find-ip-record (mmdb ip-bits)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: find-metadata-start (mmdb)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: list->number (nls radix transformer)
Package

ru.bazon.cl-maxminddb.

Source

ip.lisp.

Function: make-maxmind-database (&key ptr filename size metadata data-offset)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: make-maxmind-database-metadata (&key node-count record-size ip-version database-type languages binary-format-major-version binary-format-minor-version build-epoch description)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: map-value (key map)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Reader: maxmind-database-data-offset (instance)
Writer: (setf maxmind-database-data-offset) (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

data-offset.

Reader: maxmind-database-filename (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

filename.

Reader: maxmind-database-metadata (instance)
Writer: (setf maxmind-database-metadata) (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

metadata.

Reader: maxmind-database-metadata-binary-format-major-version (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

binary-format-major-version.

Reader: maxmind-database-metadata-binary-format-minor-version (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

binary-format-minor-version.

Reader: maxmind-database-metadata-build-epoch (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

build-epoch.

Reader: maxmind-database-metadata-database-type (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

database-type.

Reader: maxmind-database-metadata-description (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

description.

Reader: maxmind-database-metadata-ip-version (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

ip-version.

Reader: maxmind-database-metadata-languages (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

languages.

Reader: maxmind-database-metadata-node-count (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

node-count.

Function: maxmind-database-metadata-p (object)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Reader: maxmind-database-metadata-record-size (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

record-size.

Function: maxmind-database-p (object)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Reader: maxmind-database-ptr (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

ptr.

Reader: maxmind-database-size (instance)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Target Slot

size.

Function: metadata-marker-p (mmdb offset)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mmap->mmdb (ptr file size)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-array (mmdb data-start length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-boolean (mmdb data-start length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-bytes (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-data (mmdb offset)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-data-cache-container (mmdb data-start length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-datafield-metadata (mmdb offset)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-double (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-end-marker (mmdb data-start length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-float (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-int32 (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-map (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-mapentry (mmdb offset)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-node (mmdb node-number bit)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-pointer (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-raw-uchar (mmdb offset)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-raw-unsigned (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-special-generic-length (mmdb offset length0)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-special-pointer-length (mmdb offset length0)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-uint128 (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-uint16 (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-uint32 (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-uint64 (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-unsigned (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: mread-utf8-string (mmdb offset length)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Function: parse-ip (ip-address)
Package

ru.bazon.cl-maxminddb.

Source

ip.lisp.

Function: parse-ipv4 (ip-address)
Package

ru.bazon.cl-maxminddb.

Source

ip.lisp.

Function: parse-ipv6 (ip-address)
Package

ru.bazon.cl-maxminddb.

Source

ip.lisp.

Function: read-metadata (mmdb offset)
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.


6.2.3 Structures

Structure: maxmind-database
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: ptr
Readers

maxmind-database-ptr.

Writers

This slot is read-only.

Slot: filename
Readers

maxmind-database-filename.

Writers

This slot is read-only.

Slot: size
Initform

0

Readers

maxmind-database-size.

Writers

This slot is read-only.

Slot: metadata
Readers

maxmind-database-metadata.

Writers

(setf maxmind-database-metadata).

Slot: data-offset
Type

fixnum

Initform

-1

Readers

maxmind-database-data-offset.

Writers

(setf maxmind-database-data-offset).

Structure: maxmind-database-metadata
Package

ru.bazon.cl-maxminddb.

Source

maxminddb.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: node-count
Type

fixnum

Initform

0

Readers

maxmind-database-metadata-node-count.

Writers

This slot is read-only.

Slot: record-size
Type

fixnum

Initform

0

Readers

maxmind-database-metadata-record-size.

Writers

This slot is read-only.

Slot: ip-version
Type

fixnum

Initform

0

Readers

maxmind-database-metadata-ip-version.

Writers

This slot is read-only.

Slot: database-type
Type

string

Readers

maxmind-database-metadata-database-type.

Writers

This slot is read-only.

Slot: languages
Type

vector

Readers

maxmind-database-metadata-languages.

Writers

This slot is read-only.

Slot: binary-format-major-version
Type

fixnum

Initform

0

Readers

maxmind-database-metadata-binary-format-major-version.

Writers

This slot is read-only.

Slot: binary-format-minor-version
Type

fixnum

Initform

0

Readers

maxmind-database-metadata-binary-format-minor-version.

Writers

This slot is read-only.

Slot: build-epoch
Type

fixnum

Initform

0

Readers

maxmind-database-metadata-build-epoch.

Writers

This slot is read-only.

Slot: description
Type

list

Readers

maxmind-database-metadata-description.

Writers

This slot is read-only.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
B   C   F   G   L   M   P   R   W  
Index Entry  Section

(
(setf maxmind-database-data-offset): Private ordinary functions
(setf maxmind-database-metadata): Private ordinary functions

B
binary-128: Private ordinary functions
binary-32: Private ordinary functions
binary-list: Private ordinary functions

C
char->number: Private ordinary functions
copy-maxmind-database: Private ordinary functions
copy-maxmind-database-metadata: Private ordinary functions

F
find-ip-record: Private ordinary functions
find-metadata-start: Private ordinary functions
Function, (setf maxmind-database-data-offset): Private ordinary functions
Function, (setf maxmind-database-metadata): Private ordinary functions
Function, binary-128: Private ordinary functions
Function, binary-32: Private ordinary functions
Function, binary-list: Private ordinary functions
Function, char->number: Private ordinary functions
Function, copy-maxmind-database: Private ordinary functions
Function, copy-maxmind-database-metadata: Private ordinary functions
Function, find-ip-record: Private ordinary functions
Function, find-metadata-start: Private ordinary functions
Function, get-in: Public ordinary functions
Function, list->number: Private ordinary functions
Function, make-maxmind-database: Private ordinary functions
Function, make-maxmind-database-metadata: Private ordinary functions
Function, make-mmdb: Public ordinary functions
Function, map-value: Private ordinary functions
Function, maxmind-database-data-offset: Private ordinary functions
Function, maxmind-database-filename: Private ordinary functions
Function, maxmind-database-metadata: Private ordinary functions
Function, maxmind-database-metadata-binary-format-major-version: Private ordinary functions
Function, maxmind-database-metadata-binary-format-minor-version: Private ordinary functions
Function, maxmind-database-metadata-build-epoch: Private ordinary functions
Function, maxmind-database-metadata-database-type: Private ordinary functions
Function, maxmind-database-metadata-description: Private ordinary functions
Function, maxmind-database-metadata-ip-version: Private ordinary functions
Function, maxmind-database-metadata-languages: Private ordinary functions
Function, maxmind-database-metadata-node-count: Private ordinary functions
Function, maxmind-database-metadata-p: Private ordinary functions
Function, maxmind-database-metadata-record-size: Private ordinary functions
Function, maxmind-database-p: Private ordinary functions
Function, maxmind-database-ptr: Private ordinary functions
Function, maxmind-database-size: Private ordinary functions
Function, metadata-marker-p: Private ordinary functions
Function, mmap->mmdb: Private ordinary functions
Function, mmdb-query: Public ordinary functions
Function, mread-array: Private ordinary functions
Function, mread-boolean: Private ordinary functions
Function, mread-bytes: Private ordinary functions
Function, mread-data: Private ordinary functions
Function, mread-data-cache-container: Private ordinary functions
Function, mread-datafield-metadata: Private ordinary functions
Function, mread-double: Private ordinary functions
Function, mread-end-marker: Private ordinary functions
Function, mread-float: Private ordinary functions
Function, mread-int32: Private ordinary functions
Function, mread-map: Private ordinary functions
Function, mread-mapentry: Private ordinary functions
Function, mread-node: Private ordinary functions
Function, mread-pointer: Private ordinary functions
Function, mread-raw-uchar: Private ordinary functions
Function, mread-raw-unsigned: Private ordinary functions
Function, mread-special-generic-length: Private ordinary functions
Function, mread-special-pointer-length: Private ordinary functions
Function, mread-uint128: Private ordinary functions
Function, mread-uint16: Private ordinary functions
Function, mread-uint32: Private ordinary functions
Function, mread-uint64: Private ordinary functions
Function, mread-unsigned: Private ordinary functions
Function, mread-utf8-string: Private ordinary functions
Function, parse-ip: Private ordinary functions
Function, parse-ipv4: Private ordinary functions
Function, parse-ipv6: Private ordinary functions
Function, read-metadata: Private ordinary functions

G
get-in: Public ordinary functions

L
list->number: Private ordinary functions

M
Macro, with-mmdb: Public macros
make-maxmind-database: Private ordinary functions
make-maxmind-database-metadata: Private ordinary functions
make-mmdb: Public ordinary functions
map-value: Private ordinary functions
maxmind-database-data-offset: Private ordinary functions
maxmind-database-filename: Private ordinary functions
maxmind-database-metadata: Private ordinary functions
maxmind-database-metadata-binary-format-major-version: Private ordinary functions
maxmind-database-metadata-binary-format-minor-version: Private ordinary functions
maxmind-database-metadata-build-epoch: Private ordinary functions
maxmind-database-metadata-database-type: Private ordinary functions
maxmind-database-metadata-description: Private ordinary functions
maxmind-database-metadata-ip-version: Private ordinary functions
maxmind-database-metadata-languages: Private ordinary functions
maxmind-database-metadata-node-count: Private ordinary functions
maxmind-database-metadata-p: Private ordinary functions
maxmind-database-metadata-record-size: Private ordinary functions
maxmind-database-p: Private ordinary functions
maxmind-database-ptr: Private ordinary functions
maxmind-database-size: Private ordinary functions
metadata-marker-p: Private ordinary functions
mmap->mmdb: Private ordinary functions
mmdb-query: Public ordinary functions
mread-array: Private ordinary functions
mread-boolean: Private ordinary functions
mread-bytes: Private ordinary functions
mread-data: Private ordinary functions
mread-data-cache-container: Private ordinary functions
mread-datafield-metadata: Private ordinary functions
mread-double: Private ordinary functions
mread-end-marker: Private ordinary functions
mread-float: Private ordinary functions
mread-int32: Private ordinary functions
mread-map: Private ordinary functions
mread-mapentry: Private ordinary functions
mread-node: Private ordinary functions
mread-pointer: Private ordinary functions
mread-raw-uchar: Private ordinary functions
mread-raw-unsigned: Private ordinary functions
mread-special-generic-length: Private ordinary functions
mread-special-pointer-length: Private ordinary functions
mread-uint128: Private ordinary functions
mread-uint16: Private ordinary functions
mread-uint32: Private ordinary functions
mread-uint64: Private ordinary functions
mread-unsigned: Private ordinary functions
mread-utf8-string: Private ordinary functions

P
parse-ip: Private ordinary functions
parse-ipv4: Private ordinary functions
parse-ipv6: Private ordinary functions

R
read-metadata: Private ordinary functions

W
with-mmdb: Public macros

Jump to:   (  
B   C   F   G   L   M   P   R   W