Adding initial code jy.oak@samsung.com
[ric-app/kpimon.git] / asn1c_defs / all-defs / OCTET_STRING.h
1 /*-\r
2  * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.\r
3  * Redistribution and modifications are permitted subject to BSD license.\r
4  */\r
5 #ifndef _OCTET_STRING_H_\r
6 #define _OCTET_STRING_H_\r
7 \r
8 #include <asn_application.h>\r
9 \r
10 #ifdef __cplusplus\r
11 extern "C" {\r
12 #endif\r
13 \r
14 typedef struct OCTET_STRING {\r
15         uint8_t *buf;   /* Buffer with consecutive OCTET_STRING bits */\r
16         size_t size;    /* Size of the buffer */\r
17 \r
18         asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */\r
19 } OCTET_STRING_t;\r
20 \r
21 extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING;\r
22 extern asn_TYPE_operation_t asn_OP_OCTET_STRING;\r
23 \r
24 asn_struct_free_f OCTET_STRING_free;\r
25 asn_struct_print_f OCTET_STRING_print;\r
26 asn_struct_print_f OCTET_STRING_print_utf8;\r
27 asn_struct_compare_f OCTET_STRING_compare;\r
28 ber_type_decoder_f OCTET_STRING_decode_ber;\r
29 der_type_encoder_f OCTET_STRING_encode_der;\r
30 xer_type_decoder_f OCTET_STRING_decode_xer_hex;         /* Hexadecimal */\r
31 xer_type_decoder_f OCTET_STRING_decode_xer_binary;      /* 01010111010 */\r
32 xer_type_decoder_f OCTET_STRING_decode_xer_utf8;        /* ASCII/UTF-8 */\r
33 xer_type_encoder_f OCTET_STRING_encode_xer;\r
34 xer_type_encoder_f OCTET_STRING_encode_xer_utf8;\r
35 oer_type_decoder_f OCTET_STRING_decode_oer;\r
36 oer_type_encoder_f OCTET_STRING_encode_oer;\r
37 per_type_decoder_f OCTET_STRING_decode_uper;\r
38 per_type_encoder_f OCTET_STRING_encode_uper;\r
39 per_type_decoder_f OCTET_STRING_decode_aper;\r
40 per_type_encoder_f OCTET_STRING_encode_aper;\r
41 asn_random_fill_f  OCTET_STRING_random_fill;\r
42 \r
43 #define OCTET_STRING_constraint  asn_generic_no_constraint\r
44 #define OCTET_STRING_decode_xer  OCTET_STRING_decode_xer_hex\r
45 \r
46 /******************************\r
47  * Handy conversion routines. *\r
48  ******************************/\r
49 \r
50 /*\r
51  * This function clears the previous value of the OCTET STRING (if any)\r
52  * and then allocates a new memory with the specified content (str/size).\r
53  * If size = -1, the size of the original string will be determined\r
54  * using strlen(str).\r
55  * If str equals to NULL, the function will silently clear the\r
56  * current contents of the OCTET STRING.\r
57  * Returns 0 if it was possible to perform operation, -1 otherwise.\r
58  */\r
59 int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size);\r
60 \r
61 /* Handy conversion from the C string into the OCTET STRING. */\r
62 #define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1)\r
63 \r
64 /*\r
65  * Allocate and fill the new OCTET STRING and return a pointer to the newly\r
66  * allocated object. NULL is permitted in str: the function will just allocate\r
67  * empty OCTET STRING.\r
68  */\r
69 OCTET_STRING_t *OCTET_STRING_new_fromBuf(const asn_TYPE_descriptor_t *td,\r
70                                          const char *str, int size);\r
71 \r
72 /****************************\r
73  * Internally useful stuff. *\r
74  ****************************/\r
75 \r
76 typedef struct asn_OCTET_STRING_specifics_s {\r
77     /*\r
78      * Target structure description.\r
79      */\r
80     unsigned struct_size;   /* Size of the structure */\r
81     unsigned ctx_offset;    /* Offset of the asn_struct_ctx_t member */\r
82 \r
83     enum asn_OS_Subvariant {\r
84         ASN_OSUBV_ANY, /* The open type (ANY) */\r
85         ASN_OSUBV_BIT, /* BIT STRING */\r
86         ASN_OSUBV_STR, /* String types, not {BMP,Universal}String  */\r
87         ASN_OSUBV_U16, /* 16-bit character (BMPString) */\r
88         ASN_OSUBV_U32  /* 32-bit character (UniversalString) */\r
89     } subvariant;\r
90 } asn_OCTET_STRING_specifics_t;\r
91 \r
92 extern asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs;\r
93 \r
94 size_t OCTET_STRING_random_length_constrained(\r
95     const asn_TYPE_descriptor_t *, const asn_encoding_constraints_t *,\r
96     size_t max_length);\r
97 \r
98 #ifdef __cplusplus\r
99 }\r
100 #endif\r
101 \r
102 #endif  /* _OCTET_STRING_H_ */\r