sysdb_services.h revision d0483eefc41ac295ed4c56e08ad76ca7b5fb3b2c
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher/*
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher SSSD
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher Authors:
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher Stephen Gallagher <sgallagh@redhat.com>
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher Copyright (C) 2012 Red Hat
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher This program is free software; you can redistribute it and/or modify
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher it under the terms of the GNU General Public License as published by
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher the Free Software Foundation; either version 3 of the License, or
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher (at your option) any later version.
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher This program is distributed in the hope that it will be useful,
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher but WITHOUT ANY WARRANTY; without even the implied warranty of
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher GNU General Public License for more details.
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher You should have received a copy of the GNU General Public License
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher along with this program. If not, see <http://www.gnu.org/licenses/>.
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher*/
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher#ifndef SYSDB_SERVICES_H_
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher#define SYSDB_SERVICES_H_
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher#define SYSDB_SVC_CLASS "service"
10afbe39cb81a1810dba486c4b8e46578bb300bbStephen Gallagher#define SYSDB_SVC_CONTAINER "cn=services"
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_SC "objectclass="SYSDB_SVC_CLASS
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_SVC_PORT "servicePort"
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_SVC_PROTO "serviceProtocol"
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_TMPL_SVC_BASE SYSDB_SVC_CONTAINER",cn=%s,"SYSDB_BASE
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_TMPL_SVC SYSDB_NAME"=%s,"SYSDB_TMPL_SVC_BASE
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_SVC_BYNAME_FILTER "(&("SYSDB_SC")("SYSDB_SVC_PROTO"=%s)(|("SYSDB_NAME_ALIAS"=%s)("SYSDB_NAME"=%s)))"
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_SVC_BYPORT_FILTER "(&("SYSDB_SC")("SYSDB_SVC_PROTO"=%s)("SYSDB_SVC_PORT"=%u))"
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#define SYSDB_SVC_ATTRS { \
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher SYSDB_NAME, \
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher SYSDB_NAME_ALIAS, \
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher SYSDB_SVC_PORT, \
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher SYSDB_SVC_PROTO, \
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher SYSDB_DEFAULT_ATTRS, \
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher NULL }
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghererrno_t
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghersysdb_getservbyname(TALLOC_CTX *mem_ctx,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct sysdb_ctx *sysdb,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *name,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *proto,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct ldb_result **_res);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghererrno_t
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghersysdb_getservbyport(TALLOC_CTX *mem_ctx,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct sysdb_ctx *sysdb,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher int port,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *proto,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct ldb_result **_res);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghererrno_t
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghersysdb_enumservent(TALLOC_CTX *mem_ctx,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct sysdb_ctx *sysdb,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct ldb_result **_res);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghererrno_t
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghersysdb_store_service(struct sysdb_ctx *sysdb,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *primary_name,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher int port,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char **aliases,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char **protocols,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct sysdb_attrs *extra_attrs,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher char **remove_attrs,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher uint64_t cache_timeout,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher time_t now);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagherstruct ldb_dn *
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghersysdb_svc_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *domain, const char *name);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghererrno_t
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghersysdb_svc_delete(struct sysdb_ctx *sysdb,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *name,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher int port,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *proto);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghererrno_t
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghersysdb_set_service_attr(struct sysdb_ctx *sysdb,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *name,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct sysdb_attrs *attrs,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher int mod_op);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallaghererrno_t sysdb_search_services(TALLOC_CTX *mem_ctx,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct sysdb_ctx *sysdb,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char *sub_filter,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher const char **attrs,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher size_t *msgs_count,
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher struct ldb_message ***msgs);
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher#endif /* SYSDB_SERVICES_H_ */
2dd3faebcd3cfd00efda38ffd2585d675e696b12Stephen Gallagher