CAGL API
The following section describes the functions that you can use with the Compile-and-Go Library.
int ossCreateControlTable(ossAsn1Global *aworld, char *cmd_line, char *err_file, void **ctl_tbl);
Generates a dynamic in-memory control table (instead of a pre-compiled static control table) for a given ASN.1 specification, which can be passed to ossinit().
Arguments
- aworld
- OSS environment variable used with dynamic control table creation and access.
- cmd_line
- ASN.1 compiler command-line arguments ("-root -per mySyntax.asn").
- err_file
- Pathname of the file containing any diagnostic output issued by the dynamic ASN.1 compiler (use "-" to specify stdout and "+" to specify stdrr).
- ctl_tbl
- Address of a void pointer that references the dynamically created control table.
Return Value
If successful, returns zero. Otherwise, returns a non-zero value.
Example
OssGlobal w, *world = &w; OssAsn1Global *aworld; void *controlHeader=NULL; OssBuf encodedData; /* length and address of encoded data */ DataPacket myPacket; aworld = ossGetAsn1CompilerHandle(userMalloc, userFree, userRealloc); rc = ossCreateControlTable(aworld, cmdLine, errFile, &controlHeader); ossinit(world, controlHeader); . . . encodedData.value = NULL; /* Intialize encoder output buffer */ encodedData.length = 0; ossEncode(world, DataPacket_PDU, &myPacket, &encodedData); . . . /* free all allocated PDUs, encoder buffers, terminate OSS runtime environment, free the control table handle, and terminate the OSS ASN.1 compiler environment. */ ossterm(world); ossDeleteControlTable(aworld, controlHeader); ossDeleteAsn1CompilerHandle(aworld);
See Also
ossAsn1Global
*ossGetAsn1CompilerHandle(
void *(*userMalloc)(size_t size),
void (*userFree)(void *buf),
void *(*userRealloc)(void *buf, size_t size));
Prepares and initializes the OSS environment to allow the dynamic creation of control tables via the ossCreateControlTable() function. Additionally, you can specify allocation, reallocation, and deallocation functions when dynamically creating control tables.
Arguments
- userMalloc
- Allocation routine function pointer.
- userFree
- Deallocation routine function pointer.
- userRealloc
- Reallocation routine function pointer.
To enable the default memory routines, pass NULL to any or all of the three parameters (malloc(), free(), and realloc()).
Return Value
Returns the address of a newly allocated Dynamic Control Table Creation environment variable. You can pass the returned structure to the ossCreateControlTable() function.
See Also
void ossDeleteAsn1CompilerHandle(ossAsn1Global *aworld);
Releases the resources allocated by ossGetAsn1CompilerHandle(). In multi-threaded applications this function must be called after the last call to ossterm() | ossUterm() | ossWterm().
Arguments
- aworld
- OSS environment variable used with dynamic control table creation and access.
See Also
void ossDeleteControlTable(struct ossAsn1Global *aworld, void *ctbl_hdl);
Releases the resources and control table allocated by ossCreateControlTable(). This function is called after a dynamically created control table is no longer needed and after calling ossterm().
Arguments
- aworld
- OSS environment variable used with dynamic control table creation and access.
- ctbl_hdl
- Pointer to the control table that will be deleted.
See Also
This documentation applies to the OSS® ASN.1 Tools for C release 12.0 and later.
Copyright © 2025 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C are available to you.

