62. Adding new drivers or lookup types
Author: The Exim Project. <https://www.exim.org/>
Description: Exim is a message transfer agent (MTA) developed at the University of Cambridge for use on Unix systems connected to the Internet.
Keywords: exim,smtp,mta,email

# Exim Internet Mailer

<-previous next->

## Chapter 62 - Adding new drivers or lookup types

The following actions have to be taken in order to add a new router, transport, authenticator, or lookup type to Exim:

1. Choose a name for the driver or lookup type that does not conflict with any existing name; I will use “newdriver” in what follows.

2. Add to src/EDITME the line:

       <type>_NEWDRIVER=yes

   where <type> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the code is not to be included in the binary by default, comment this line out. You should also add any relevant comments about the driver or lookup type.

3. Add to src/config.h.defaults the line:

       #define <type>_NEWDRIVER

4. Edit src/drtables.c, adding conditional code to pull in the private header and create a table entry as is done for all the other drivers and lookup types.

5. Edit scripts/lookups-Makefile if this is a new lookup; there is a for-loop near the bottom, ranging the `name_mod` variable over a list of all lookups. Add your `NEWDRIVER` to that list. As long as the dynamic module would be named newdriver.so, you can use the simple form that most lookups have.

6. Edit Makefile in the appropriate sub-directory (src/routers, src/transports, src/auths, or src/lookups); add a line for the new driver or lookup type and add it to the definition of OBJ.

7. Edit OS/Makefile-Base adding a .o file for the predefined-macros, to the definition of OBJ_MACRO. Add a set of line to do the compile also.

8. Create newdriver.h and newdriver.c in the appropriate sub-directory of src.

9. Edit scripts/MakeLinks and add commands to link the .h and .c files as for other drivers and lookups.

Then all you need to do is write the code! A good way to start is to make a proforma by copying an existing module of the same type, globally changing all occurrences of the name, and cutting out most of the code. Note that any options you create must be listed in alphabetical order, because the tables are searched using a binary chop procedure.

There is a README file in each of the sub-directories of src describing the interface that is expected.

<-previous Table of Contents next->