# Internal API

The domain module has an internal API which can be used to access additional functions of the module (i.e. functions that are normally not available from the routing script). Currently the API exports only the function `is_domain_local`. That function can be used to determine whether a given domain name is on the list of locally configured domain names.

If you want to use the internal API of domain module from your module then you need to include the header file `domain_api.h` and call `load_domain_api` first.

## Calling `load_domain_api`

    #include "../domain/domain_api.h"

    domain_api_t dom_api;

    if (load_domain_api(&dom_api) != 0) {
        /* error */
    }

After that you can call function `is_domain_local` whose pointer is stored in the initialized data structure:

    str tmp = STR_STATIC_INIT("mydomain.com");

    if (dom_api.is_domain_local(&tmp) == 1) {
        /* Domain is local */
    } else {
        /* Domain is not local or an error was encountered */
    }