]> git.stg.codes - stg.git/blobdiff - libs/smux/include/stg/asn_codecs.h
More std::jthread stuff.
[stg.git] / libs / smux / include / stg / asn_codecs.h
index 4a251d940880a03b24dc9f3fe41f2febb9b49211..e75c2709cd956507df15791c7b602996fbced9a8 100644 (file)
@@ -1,10 +1,9 @@
-/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
+/*
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
  * Redistribution and modifications are permitted subject to BSD license.
  */
  * Redistribution and modifications are permitted subject to BSD license.
  */
-#ifndef        _ASN_CODECS_H_
-#define        _ASN_CODECS_H_
+#ifndef        ASN_CODECS_H
+#define        ASN_CODECS_H
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,20 +51,20 @@ typedef struct asn_enc_rval_s {
         */
 
        /* Type which cannot be encoded */
         */
 
        /* Type which cannot be encoded */
-       struct asn_TYPE_descriptor_s *failed_type;
+       const struct asn_TYPE_descriptor_s *failed_type;
 
        /* Pointer to the structure of that type */
 
        /* Pointer to the structure of that type */
-       void *structure_ptr;
+       const void *structure_ptr;
 } asn_enc_rval_t;
 } asn_enc_rval_t;
-#define        _ASN_ENCODE_FAILED do {                                 \
+#define        ASN__ENCODE_FAILED do {                                 \
        asn_enc_rval_t tmp_error;                               \
        tmp_error.encoded = -1;                                 \
        tmp_error.failed_type = td;                             \
        tmp_error.structure_ptr = sptr;                         \
        asn_enc_rval_t tmp_error;                               \
        tmp_error.encoded = -1;                                 \
        tmp_error.failed_type = td;                             \
        tmp_error.structure_ptr = sptr;                         \
-       ASN_DEBUG("Failed to encode element %s", td->name);     \
+       ASN_DEBUG("Failed to encode element %s", td ? td->name : "");   \
        return tmp_error;                                       \
 } while(0)
        return tmp_error;                                       \
 } while(0)
-#define        _ASN_ENCODED_OK(rval) do {                              \
+#define        ASN__ENCODED_OK(rval) do {                              \
        rval.structure_ptr = 0;                                 \
        rval.failed_type = 0;                                   \
        return rval;                                            \
        rval.structure_ptr = 0;                                 \
        rval.failed_type = 0;                                   \
        return rval;                                            \
@@ -88,14 +87,14 @@ typedef struct asn_dec_rval_s {
        enum asn_dec_rval_code_e code;  /* Result code */
        size_t consumed;                /* Number of bytes consumed */
 } asn_dec_rval_t;
        enum asn_dec_rval_code_e code;  /* Result code */
        size_t consumed;                /* Number of bytes consumed */
 } asn_dec_rval_t;
-#define        _ASN_DECODE_FAILED do {                                 \
+#define        ASN__DECODE_FAILED do {                                 \
        asn_dec_rval_t tmp_error;                               \
        tmp_error.code = RC_FAIL;                               \
        tmp_error.consumed = 0;                                 \
        asn_dec_rval_t tmp_error;                               \
        tmp_error.code = RC_FAIL;                               \
        tmp_error.consumed = 0;                                 \
-       ASN_DEBUG("Failed to decode element %s", td->name);     \
+       ASN_DEBUG("Failed to decode element %s", td ? td->name : "");   \
        return tmp_error;                                       \
 } while(0)
        return tmp_error;                                       \
 } while(0)
-#define        _ASN_DECODE_STARVED do {                                \
+#define        ASN__DECODE_STARVED do {                                \
        asn_dec_rval_t tmp_error;                               \
        tmp_error.code = RC_WMORE;                              \
        tmp_error.consumed = 0;                                 \
        asn_dec_rval_t tmp_error;                               \
        tmp_error.code = RC_WMORE;                              \
        tmp_error.consumed = 0;                                 \
@@ -106,4 +105,4 @@ typedef struct asn_dec_rval_s {
 }
 #endif
 
 }
 #endif
 
-#endif /* _ASN_CODECS_H_ */
+#endif /* ASN_CODECS_H */