irias_object.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*********************************************************************
  2. *
  3. * Filename: irias_object.h
  4. * Version:
  5. * Description:
  6. * Status: Experimental.
  7. * Author: Dag Brattli <dagb@cs.uit.no>
  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 <dagb@cs.uit.no>
  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. #ifndef LM_IAS_OBJECT_H
  25. #define LM_IAS_OBJECT_H
  26. #include <net/irda/irda.h>
  27. #include <net/irda/irqueue.h>
  28. /* LM-IAS Attribute types */
  29. #define IAS_MISSING 0
  30. #define IAS_INTEGER 1
  31. #define IAS_OCT_SEQ 2
  32. #define IAS_STRING 3
  33. /* Object ownership of attributes (user or kernel) */
  34. #define IAS_KERNEL_ATTR 0
  35. #define IAS_USER_ATTR 1
  36. /*
  37. * LM-IAS Object
  38. */
  39. struct ias_object {
  40. irda_queue_t q; /* Must be first! */
  41. magic_t magic;
  42. char *name;
  43. int id;
  44. hashbin_t *attribs;
  45. };
  46. /*
  47. * Values used by LM-IAS attributes
  48. */
  49. struct ias_value {
  50. __u8 type; /* Value description */
  51. __u8 owner; /* Managed from user/kernel space */
  52. int charset; /* Only used by string type */
  53. int len;
  54. /* Value */
  55. union {
  56. int integer;
  57. char *string;
  58. __u8 *oct_seq;
  59. } t;
  60. };
  61. /*
  62. * Attributes used by LM-IAS objects
  63. */
  64. struct ias_attrib {
  65. irda_queue_t q; /* Must be first! */
  66. int magic;
  67. char *name; /* Attribute name */
  68. struct ias_value *value; /* Attribute value */
  69. };
  70. struct ias_object *irias_new_object(char *name, int id);
  71. void irias_insert_object(struct ias_object *obj);
  72. int irias_delete_object(struct ias_object *obj);
  73. int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib,
  74. int cleanobject);
  75. void __irias_delete_object(struct ias_object *obj);
  76. void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,
  77. int user);
  78. void irias_add_string_attrib(struct ias_object *obj, char *name, char *value,
  79. int user);
  80. void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
  81. int len, int user);
  82. int irias_object_change_attribute(char *obj_name, char *attrib_name,
  83. struct ias_value *new_value);
  84. struct ias_object *irias_find_object(char *name);
  85. struct ias_attrib *irias_find_attrib(struct ias_object *obj, char *name);
  86. struct ias_value *irias_new_string_value(char *string);
  87. struct ias_value *irias_new_integer_value(int integer);
  88. struct ias_value *irias_new_octseq_value(__u8 *octseq , int len);
  89. struct ias_value *irias_new_missing_value(void);
  90. void irias_delete_value(struct ias_value *value);
  91. extern struct ias_value irias_missing;
  92. extern hashbin_t *irias_objects;
  93. #endif