12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /*
- * object.h
- *
- * Copyright (C) 2013 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef _OBJECT_H_
- #define _OBJECT_H_
- #include <common.h>
- #include <lock.h>
- #include <sdk/object.h>
- #include <sdk/list.h>
- #include <sdk/user.h>
- typedef struct
- {
- list_entry_t link;
- dword_t uid;
- access_flags_t access_mask;
- } access_control_entry_t;
- typedef struct
- {
- list_entry_t by_name_list;
- list_entry_t by_type_list;
- char *name;
- qword_t ref_count;
- dword_t open_count;
- object_type_t type;
- uid_t owner;
- lock_t acl_lock;
- list_entry_t acl;
- } object_t;
- static inline void init_object(object_t *object, const char *name, object_type_t type)
- {
- object->name = name ? strdup(name) : NULL;
- object->type = type;
- }
- dword_t create_object(object_t *object);
- void reference(object_t *object);
- void dereference(object_t *object);
- bool_t reference_by_name(const char *name, object_type_t type, object_t **object);
- bool_t reference_by_handle(handle_t handle, object_type_t type, object_t **object);
- dword_t open_object(object_t *obj, access_flags_t access_flags, handle_t *handle);
- dword_t open_object_by_name(const char *name, object_type_t type, access_flags_t access_flags, handle_t *handle);
- void close_object_internal(object_t *obj);
- dword_t enum_objects_by_type(object_type_t type, object_t **object);
- void object_init(void);
- #endif
|