Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
irias_object.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Filename: irias_object.h
4  * Version:
5  * Description:
6  * Status: Experimental.
7  * Author: Dag Brattli <[email protected]>
8  * Created at: Thu Oct 1 22:49:50 1998
9  * Modified at: Wed Dec 15 11:20:57 1999
10  * Modified by: Dag Brattli <[email protected]>
11  *
12  * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License as
16  * published by the Free Software Foundation; either version 2 of
17  * the License, or (at your option) any later version.
18  *
19  * Neither Dag Brattli nor University of Tromsø admit liability nor
20  * provide warranty for any of this software. This material is
21  * provided "AS-IS" and at no charge.
22  *
23  ********************************************************************/
24 
25 #ifndef LM_IAS_OBJECT_H
26 #define LM_IAS_OBJECT_H
27 
28 #include <net/irda/irda.h>
29 #include <net/irda/irqueue.h>
30 
31 /* LM-IAS Attribute types */
32 #define IAS_MISSING 0
33 #define IAS_INTEGER 1
34 #define IAS_OCT_SEQ 2
35 #define IAS_STRING 3
36 
37 /* Object ownership of attributes (user or kernel) */
38 #define IAS_KERNEL_ATTR 0
39 #define IAS_USER_ATTR 1
40 
41 /*
42  * LM-IAS Object
43  */
44 struct ias_object {
45  irda_queue_t q; /* Must be first! */
47 
48  char *name;
49  int id;
51 };
52 
53 /*
54  * Values used by LM-IAS attributes
55  */
56 struct ias_value {
57  __u8 type; /* Value description */
58  __u8 owner; /* Managed from user/kernel space */
59  int charset; /* Only used by string type */
60  int len;
61 
62  /* Value */
63  union {
64  int integer;
65  char *string;
67  } t;
68 };
69 
70 /*
71  * Attributes used by LM-IAS objects
72  */
73 struct ias_attrib {
74  irda_queue_t q; /* Must be first! */
75  int magic;
76 
77  char *name; /* Attribute name */
78  struct ias_value *value; /* Attribute value */
79 };
80 
81 struct ias_object *irias_new_object(char *name, int id);
82 void irias_insert_object(struct ias_object *obj);
83 int irias_delete_object(struct ias_object *obj);
84 int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib,
85  int cleanobject);
86 void __irias_delete_object(struct ias_object *obj);
87 
88 void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,
89  int user);
90 void irias_add_string_attrib(struct ias_object *obj, char *name, char *value,
91  int user);
92 void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
93  int len, int user);
94 int irias_object_change_attribute(char *obj_name, char *attrib_name,
95  struct ias_value *new_value);
96 struct ias_object *irias_find_object(char *name);
97 struct ias_attrib *irias_find_attrib(struct ias_object *obj, char *name);
98 
99 struct ias_value *irias_new_string_value(char *string);
101 struct ias_value *irias_new_octseq_value(__u8 *octseq , int len);
102 struct ias_value *irias_new_missing_value(void);
103 void irias_delete_value(struct ias_value *value);
104 
105 extern struct ias_value irias_missing;
106 extern hashbin_t *irias_objects;
107 
108 #endif