domain_api.h

00001 /*
00002  * Domain module internal API
00003  *
00004  * Copyright (C) 2002-2003 Juha Heinanen
00005  *
00006  * This file is part of sip-router, a free SIP server.
00007  *
00008  * sip-router is free software; you can redistribute it and/or modify it under
00009  * the terms of the GNU General Public License as published by the Free
00010  * Software Foundation; either version 2 of the License, or (at your option)
00011  * any later version
00012  *
00013  * sip-router is distributed in the hope that it will be useful, but WITHOUT
00014  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00016  * more details.
00017  *
00018  * You should have received a copy of the GNU General Public License along
00019  * with this program; if not, write to the Free Software Foundation, Inc.,
00020  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00021  */
00022 
00023 #ifndef _DOMAIN_API_H
00024 #define _DOMAIN_API_H
00025 
00026 #include "../../sr_module.h"
00027 #include "../../dprint.h"
00028 #include "domain.h"
00029 
00030 typedef struct domain_api {
00031         is_domain_local_f is_domain_local;
00032 } domain_api_t;
00033 
00034 typedef int (*bind_domain_f)(domain_api_t* api);
00035 int bind_domain(domain_api_t* api);
00036 
00037 static inline int load_domain_api(domain_api_t* api)
00038 {
00039         bind_domain_f bind_domain;
00040 
00041         bind_domain = (bind_domain_f)find_export("bind_domain", 0, 0);
00042 
00043         if (bind_domain == NULL) {
00044                 ERR("Cannot import bind_domain function from domain module\n");
00045                 return -1;
00046         }
00047 
00048         if (bind_domain(api) == -1) {
00049                 return -1;
00050         }
00051         return 0;
00052 }
00053 
00054 
00055 #endif /* _DOMAIN_API_H */