• Main Page
  • Related Pages
  • Files
  • File List
  • Globals

creds.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of libcreds.
00003  *
00004  * Copyright (C) 2009 Nokia Corporation. All rights reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person
00007  * obtaining a copy of this software and associated documentation
00008  * files (the "Software"), to deal in the Software without
00009  * restriction, including without limitation the rights to use, copy,
00010  * modify, merge, publish, distribute, sublicense, and/or sell copies
00011  * of the Software, and to permit persons to whom the Software is
00012  * furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be
00015  * included in all copies or substantial portions of the Software.
00016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00017  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00019  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00020  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00021  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00023  * SOFTWARE.
00024  */
00025 
00045 #ifndef _SYS_CREDS_H
00046 #define _SYS_CREDS_H
00047 
00048 #include <sys/types.h>
00049 #include <stdint.h>
00050 
00051 #ifdef  __cplusplus
00052 extern "C" {
00053 #endif
00054 
00058 typedef int creds_type_t;
00059 
00060 #define CREDS_BAD       -1      /* Indicates error */
00061 
00065 typedef long creds_value_t;
00066 
00075 typedef struct _creds_struct *creds_t;
00076 
00077 
00089 creds_t creds_getpeer(int socket);
00090 
00105 creds_t creds_gettask(pid_t pid);
00106 
00119 creds_t creds_init();
00120 
00130 void creds_clear(creds_t creds);
00131 
00145 void creds_free(creds_t creds);
00146 
00163 int creds_set(const creds_t creds);
00164 
00182 int creds_set2(const creds_t creds, int flags);
00183 
00198 int creds_add(creds_t *creds, creds_type_t type, creds_value_t value);
00199 
00210 void creds_sub(creds_t creds, creds_type_t type, creds_value_t value);
00211 
00220 creds_type_t creds_list(const creds_t creds, int index, creds_value_t *value);
00221 
00244 int creds_find(const creds_t creds, const char *pattern, char *buf, size_t size);
00245 
00254 int creds_have_p(const creds_t creds, creds_type_t type, creds_value_t value);
00255 
00256 
00270 int creds_have_access(const creds_t creds, creds_type_t type, creds_value_t value, const char *access_type);
00271 
00298 long creds_str2creds(const char *credential, creds_value_t *value);
00299 
00313 int creds_creds2str(creds_type_t type, creds_value_t value, char *buf, size_t size);
00314 
00325 const uint32_t *creds_export(creds_t creds, size_t *length);
00326 
00336 creds_t creds_import(const uint32_t *list, size_t length);
00337 
00354 long creds_load(int flags, const char *path, const creds_t creds);
00355 
00386 long creds_confine(const char *path);
00387 
00419 long creds_confine2(const char *path, int flags, const creds_t creds);
00420 
00446 int credp_str2flags(const char *str, int *mask);
00447 
00461 size_t credp_flags2str(int flags, int mask, char *buf, size_t size);
00462 
00463 #ifdef  __cplusplus
00464 }
00465 #endif
00466 #endif

Generated on Tue Apr 5 2011 18:57:37 for - by  doxygen 1.7.1