linux/net/netfilter/nf_conntrack_h323_asn1.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * BER and PER decoding library for H.323 conntrack/NAT module.
 *
 * Copyright (c) 2006 by Jing Min Zhao <[email protected]>
 *
 * See nf_conntrack_helper_h323_asn1.h for details.
 */

#ifdef __KERNEL__
#include <linux/kernel.h>
#else
#include <stdio.h>
#endif
#include <linux/netfilter/nf_conntrack_h323_asn1.h>

/* Trace Flag */
#ifndef H323_TRACE
#define H323_TRACE
#endif

#if H323_TRACE
#define TAB_SIZE
#define IFTHEN
#ifdef __KERNEL__
#define PRINT
#else
#define PRINT
#endif
#define FNAME
#else
#define IFTHEN(cond, act)
#define PRINT(fmt, args...)
#define FNAME(name)
#endif

/* ASN.1 Types */
#define NUL
#define BOOL
#define OID
#define INT
#define ENUM
#define BITSTR
#define NUMSTR
#define NUMDGT
#define TBCDSTR
#define OCTSTR
#define PRTSTR
#define IA5STR
#define GENSTR
#define BMPSTR
#define SEQ
#define SET
#define SEQOF
#define SETOF
#define CHOICE

/* Constraint Types */
#define FIXD
/* #define BITS 1-8 */
#define BYTE
#define WORD
#define CONS
#define SEMI
#define UNCO

/* ASN.1 Type Attributes */
#define SKIP
#define STOP
#define DECODE
#define EXT
#define OPEN
#define OPT


/* ASN.1 Field Structure */
field_t;

/* Bit Stream */
struct bitstr {};

/* Tool Functions */
#define INC_BIT(bs)
#define INC_BITS(bs,b)
#define BYTE_ALIGN(bs)
static unsigned int get_len(struct bitstr *bs);
static unsigned int get_bit(struct bitstr *bs);
static unsigned int get_bits(struct bitstr *bs, unsigned int b);
static unsigned int get_bitmap(struct bitstr *bs, unsigned int b);
static unsigned int get_uint(struct bitstr *bs, int b);

/* Decoder Functions */
static int decode_nul(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_bool(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_oid(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_int(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_enum(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_bitstr(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_numstr(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_octstr(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_bmpstr(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_seq(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_seqof(struct bitstr *bs, const struct field_t *f, char *base, int level);
static int decode_choice(struct bitstr *bs, const struct field_t *f, char *base, int level);

/* Decoder Functions Vector */
decoder_t;
static const decoder_t Decoders[] =;

/*
 * H.323 Types
 */
#include "nf_conntrack_h323_types.c"

/*
 * Functions
 */

/* Assume bs is aligned && v < 16384 */
static unsigned int get_len(struct bitstr *bs)
{}

static int nf_h323_error_boundary(struct bitstr *bs, size_t bytes, size_t bits)
{}

static unsigned int get_bit(struct bitstr *bs)
{}

/* Assume b <= 8 */
static unsigned int get_bits(struct bitstr *bs, unsigned int b)
{}

/* Assume b <= 32 */
static unsigned int get_bitmap(struct bitstr *bs, unsigned int b)
{}

/*
 * Assume bs is aligned and sizeof(unsigned int) == 4
 */
static unsigned int get_uint(struct bitstr *bs, int b)
{}

static int decode_nul(struct bitstr *bs, const struct field_t *f,
                      char *base, int level)
{}

static int decode_bool(struct bitstr *bs, const struct field_t *f,
                       char *base, int level)
{}

static int decode_oid(struct bitstr *bs, const struct field_t *f,
                      char *base, int level)
{}

static int decode_int(struct bitstr *bs, const struct field_t *f,
                      char *base, int level)
{}

static int decode_enum(struct bitstr *bs, const struct field_t *f,
                       char *base, int level)
{}

static int decode_bitstr(struct bitstr *bs, const struct field_t *f,
                         char *base, int level)
{}

static int decode_numstr(struct bitstr *bs, const struct field_t *f,
                         char *base, int level)
{}

static int decode_octstr(struct bitstr *bs, const struct field_t *f,
                         char *base, int level)
{}

static int decode_bmpstr(struct bitstr *bs, const struct field_t *f,
                         char *base, int level)
{}

static int decode_seq(struct bitstr *bs, const struct field_t *f,
                      char *base, int level)
{}

static int decode_seqof(struct bitstr *bs, const struct field_t *f,
                        char *base, int level)
{}

static int decode_choice(struct bitstr *bs, const struct field_t *f,
                         char *base, int level)
{}

int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage *ras)
{}

static int DecodeH323_UserInformation(unsigned char *buf, unsigned char *beg,
				      size_t sz, H323_UserInformation *uuie)
{}

int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz,
					 MultimediaSystemControlMessage *
					 mscm)
{}

int DecodeQ931(unsigned char *buf, size_t sz, Q931 *q931)
{}