Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

irias_object.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  * Filename:      irias_object.h
00004  * Version:       
00005  * Description:   
00006  * Status:        Experimental.
00007  * Author:        Dag Brattli <dagb@cs.uit.no>
00008  * Created at:    Thu Oct  1 22:49:50 1998
00009  * Modified at:   Wed Dec 15 11:20:57 1999
00010  * Modified by:   Dag Brattli <dagb@cs.uit.no>
00011  * 
00012  *     Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
00013  *      
00014  *     This program is free software; you can redistribute it and/or 
00015  *     modify it under the terms of the GNU General Public License as 
00016  *     published by the Free Software Foundation; either version 2 of 
00017  *     the License, or (at your option) any later version.
00018  *  
00019  *     Neither Dag Brattli nor University of Tromsų admit liability nor
00020  *     provide warranty for any of this software. This material is 
00021  *     provided "AS-IS" and at no charge.
00022  *     
00023  ********************************************************************/
00024 
00025 #ifndef LM_IAS_OBJECT_H
00026 #define LM_IAS_OBJECT_H
00027 
00028 #include <net/irda/irda.h>
00029 #include <net/irda/irqueue.h>
00030 
00031 /* LM-IAS Attribute types */
00032 #define IAS_MISSING 0
00033 #define IAS_INTEGER 1
00034 #define IAS_OCT_SEQ 2
00035 #define IAS_STRING  3
00036 
00037 /*
00038  *  LM-IAS Object
00039  */
00040 struct ias_object {
00041         queue_t q;     /* Must be first! */
00042         magic_t magic;
00043         
00044         char  *name;
00045         int   id;
00046         hashbin_t *attribs;
00047 };
00048 
00049 /*
00050  *  Values used by LM-IAS attributes
00051  */
00052 struct ias_value {
00053         __u8    type;    /* Value description */
00054         int     charset; /* Only used by string type */
00055         int     len;
00056         
00057         /* Value */
00058         union {
00059                 int integer;
00060                 char *string;
00061                 __u8 *oct_seq;
00062         } t;
00063 };
00064 
00065 /*
00066  *  Attributes used by LM-IAS objects
00067  */
00068 struct ias_attrib {
00069         queue_t q; /* Must be first! */
00070         int magic;
00071 
00072         char *name;              /* Attribute name */
00073         struct ias_value *value; /* Attribute value */
00074 };
00075 
00076 char *strdup(char *str);
00077 
00078 struct ias_object *irias_new_object(char *name, int id);
00079 void irias_insert_object(struct ias_object *obj);
00080 int  irias_delete_object(struct ias_object *obj);
00081 void __irias_delete_object(struct ias_object *obj);
00082 
00083 void irias_add_integer_attrib(struct ias_object *obj, char *name, int value);
00084 void irias_add_string_attrib(struct ias_object *obj, char *name, char *value);
00085 void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
00086                              int len);
00087 int irias_object_change_attribute(char *obj_name, char *attrib_name, 
00088                                   struct ias_value *new_value);
00089 struct ias_object *irias_find_object(char *name);
00090 struct ias_attrib *irias_find_attrib(struct ias_object *obj, char *name);
00091 
00092 struct ias_value *irias_new_string_value(char *string);
00093 struct ias_value *irias_new_integer_value(int integer);
00094 struct ias_value *irias_new_octseq_value(__u8 *octseq , int len);
00095 struct ias_value *irias_new_missing_value(void);
00096 void irias_delete_value(struct ias_value *value);
00097 
00098 extern struct ias_value missing;
00099 extern hashbin_t *objects;
00100 
00101 #endif