docsis_common.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * DOCSIS configuration file encoder.
  3. * Copyright (c) 2001 Cornel Ciocirlan, ctrl@users.sourceforge.net.
  4. * Copyright (c) 2002 Evvolve Media SRL,office@evvolve.com
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. * DOCSIS is a registered trademark of Cablelabs, http://www.cablelabs.com
  21. */
  22. #ifndef _DOCSIS_COMMON_H
  23. #define _DOCSIS_COMMON_H
  24. #include "version.h"
  25. #ifndef NUM_IDENTIFIERS
  26. #define NUM_IDENTIFIERS 123
  27. #endif /* NUM_IDENTIFIERS, needed in docsis_symtable.h */
  28. #define MAXINT 2000000000
  29. #define TLV_VSIZE 255
  30. #define TRUE 1
  31. #define FALSE 0
  32. struct symbol_entry {
  33. unsigned int id;
  34. char sym_ident[30];
  35. unsigned char docsis_code;
  36. unsigned int parent_id;
  37. int (*get_value_func) (unsigned char *, void *, struct symbol_entry *);
  38. void (*decode_func) (unsigned char *, struct symbol_entry *);
  39. unsigned int low_limit;
  40. unsigned int high_limit;
  41. };
  42. typedef struct symbol_entry symbol_type;
  43. struct tlv {
  44. unsigned char docs_code;
  45. unsigned char tlv_len;
  46. unsigned char tlv_value[TLV_VSIZE];
  47. };
  48. struct tlv_list {
  49. int tlv_count; /* How many TLVs we have in this list */
  50. struct tlv **tlvlist;
  51. };
  52. union t_val { /* union for returning token values */
  53. int intval; /* For integers */
  54. unsigned int uintval; /* For integers */
  55. symbol_type *symptr; /* For token identifiers */
  56. char *strval; /* For strings */
  57. unsigned char *ustrval; /* For strings */
  58. unsigned int ip; /* For IP Addresses */
  59. struct tlv_list *tlvlist; /* For for struct tlvlist pointers */
  60. struct tlv *tlvptr; /* For struct tlv pointers; */
  61. };
  62. #endif /* _DOCSIS_COMMON_H */