sysdb_services.h revision e299638926171e0e92a36122aeff6611cd52418d
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias/*
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias SSSD
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias Authors:
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias Stephen Gallagher <sgallagh@redhat.com>
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias Copyright (C) 2012 Red Hat
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias This program is free software; you can redistribute it and/or modify
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias it under the terms of the GNU General Public License as published by
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias the Free Software Foundation; either version 3 of the License, or
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias (at your option) any later version.
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias This program is distributed in the hope that it will be useful,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias but WITHOUT ANY WARRANTY; without even the implied warranty of
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias GNU General Public License for more details.
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias You should have received a copy of the GNU General Public License
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias along with this program. If not, see <http://www.gnu.org/licenses/>.
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias*/
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#ifndef SYSDB_SERVICES_H_
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_SERVICES_H_
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
990d9f14e81ad0ffb0fbec4224725b631f5fae27Jonathan von Schroeder#define SYSDB_SVC_CLASS "service"
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_SVC_CONTAINER "cn=services"
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_SC "objectclass="SYSDB_SVC_CLASS
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_SVC_PORT "servicePort"
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_SVC_PROTO "serviceProtocol"
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias#define SYSDB_TMPL_SVC_BASE SYSDB_SVC_CONTAINER",cn=%s,"SYSDB_BASE
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_TMPL_SVC SYSDB_NAME"=%s,"SYSDB_TMPL_SVC_BASE
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_SVC_BYNAME_FILTER "(&("SYSDB_SC")("SYSDB_SVC_PROTO"=%s)(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias#define SYSDB_SVC_BYPORT_FILTER "(&("SYSDB_SC")("SYSDB_SVC_PROTO"=%s)("SYSDB_SVC_PORT"=%u))"
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias#define SYSDB_SVC_ATTRS { \
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias SYSDB_NAME, \
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias SYSDB_NAME_ALIAS, \
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias SYSDB_SVC_PORT, \
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias SYSDB_SVC_PROTO, \
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias SYSDB_DEFAULT_ATTRS, \
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias NULL }
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias
c95de7451b35950f21196b610dab702730221a98Alexis Tsogiaserrno_t
c95de7451b35950f21196b610dab702730221a98Alexis Tsogiassysdb_getservbyname(TALLOC_CTX *mem_ctx,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias struct sysdb_ctx *sysdb,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias const char *name,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias const char *proto,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias struct ldb_result **_res);
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias
c95de7451b35950f21196b610dab702730221a98Alexis Tsogiaserrno_t
c95de7451b35950f21196b610dab702730221a98Alexis Tsogiassysdb_getservbyport(TALLOC_CTX *mem_ctx,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias struct sysdb_ctx *sysdb,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias int port,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias const char *proto,
c95de7451b35950f21196b610dab702730221a98Alexis Tsogias struct ldb_result **_res);
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiaserrno_t
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiassysdb_enumservent(TALLOC_CTX *mem_ctx,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias struct sysdb_ctx *sysdb,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias struct ldb_result **_res);
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiaserrno_t
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiassysdb_store_service(struct sysdb_ctx *sysdb,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias const char *primary_name,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias int port,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias const char **aliases,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias const char **protocols,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias struct sysdb_attrs *extra_attrs,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias char **remove_attrs,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias uint64_t cache_timeout,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias time_t now);
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiasstruct ldb_dn *
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiassysdb_svc_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias const char *domain, const char *name);
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiaserrno_t
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogiassysdb_svc_delete(struct sysdb_ctx *sysdb,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias const char *name,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias int port,
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias const char *proto);
8fb127028cb7dd361e348a3252e33487f73428bcJonathan von Schroeder
8fb127028cb7dd361e348a3252e33487f73428bcJonathan von Schroeder#endif /* SYSDB_SERVICES_H_ */
658187feb755694eb5ff29561bda7109c22c743cAlexis Tsogias