[insert project logo here (125x200px max)]

Navigator

Mailinglists

Please report any errors or ommissions you find to our `Help' mailinglist, or post a message in the Forums.

Copyright and Licensing Information

Snap is (c) Jonathan T. Moore, 1999-2002 and licensed under the GNU General Public License (GPL).

All other parts of Splash are (c) Willem de Bruijn, 2002-2003 and licensed under the BSD Open Source License.

All sourcecode is made publicly available.

Acknowledgement

Splash and the Splash website are hosted by SourceForge.net

SourceForge.net Logo

osi-open source certified logo

Splash - Documentation

SNMP Plus a Lightweight API for SNAP Handling

Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

snap_svc/snap_svc.c

Go to the documentation of this file.
00001 /* snap service library                 */
00002 /* (c) Willem de Bruijn, 2002, 2003     */
00003 /* Licensed under the BSD License       */
00004 /* snapservices library sourcefile      */
00005 
00006 /* libc includes */
00007 #include <stdlib.h>
00008 
00009 /* local includes */
00010 #include "d_printf.h"
00011 #include "snap_svc.h"
00012 
00013 /* library handling functions */
00014 void init(){
00015     svc_fun_counter = 0;
00016     svc_return = NULL;
00017     snap_external_svclib_init(); /* call library specific initialization routine */
00018     
00019     d_printf(100,"snap_svc : initialized a library\n");
00020 }
00021 
00022 void fini(){
00023     snap_external_svclib_done();
00024     svc_fun_counter = 0;
00025     if (svc_return)
00026         snap_external_svclib_free_returnstruct(svc_return);
00027 
00028     d_printf(100,"snap_svc : closed a library\n");
00029 }
00030 
00031 /* helper functions */
00032 /* free a returnpackage */
00033 struct svc_returnstruct* snap_external_svclib_free_returnstruct(struct svc_returnstruct* svc_return){
00034     int loopcount;
00035 
00036     if (svc_return){
00037         if (svc_return->list){
00038             for (loopcount = 0; loopcount < svc_return->length; loopcount ++){
00039                 if (svc_return->list[loopcount].data)
00040                     free (svc_return->list[loopcount].data);
00041                 if (svc_return->list[loopcount].oid)
00042                     free (svc_return->list[loopcount].oid);
00043             }                       
00044             free (svc_return->list);
00045         }
00046         free (svc_return);
00047         svc_return = NULL;
00048     }
00049 
00050     return svc_return;
00051 }
00052 
00053 /* free the local returnpackage */
00054 struct svc_returnstruct* snap_external_svclib_free_local_returnstruct(){
00055     if (svc_return)
00056         svc_return = snap_external_svclib_free_returnstruct(svc_return);
00057 
00058     return svc_return;
00059 }
00060 
00061 /* return the last returnstruct */
00062 struct svc_returnstruct* snap_external_svclib_getlastresult(){
00063     return svc_return;
00064 }