⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overview.ms

📁 ftam等标准协议服务器和客户端的源代码。
💻 MS
字号:
.NH 1Overview of pepsy system.XSOverview of pepsy system.XE.PPThis section describes how the various parts fit together to makethe system work.The principle behind pepsy is fairly simple.The \fBASN.1\fR is summarised as tables of integers.These tables are read by driver routines which encode or decodedata to or from the internal format that \fBISODE\fR \fBOSI\fR implementation uses.In \fBISODE\fR specific functions are generated for each \fBASN.1\fR typedefined in contrast the pepsy merely generates a new table of data whichis far far smaller..PPAs there is a great deal of effort invested in the \fBISODE\fR interface to theencoding/decoding routines pepsy automatically provides macros which mapthe original functions into the appropriate function call of a driver.This allows existing posy using code to switch to thepepsy system with \fBno changes\fRto the code \fBprovided\fR no function pointers are used to the original\fBISODE\fR functions.Even when there are function pointers used the changes are very simple andtake only a few hours to implement..NH 2Brief description of the use of the pepsy system..XSA Brief description of the use of the pepsy system..XE.NH 3Outline of the files produced under the pepsy system..XSOutline of the files produced under the pepsy system..XE.PPThe pepsy system consists of a program called \fIposy\fRwhich translates \fBASN.1\fR modules into a set of tables, called \fIposy\fR at the moment,and library of driver routines, called \fIlibpepsy.a\fR.Running this \fIposy\fR program on the \fBASN.1\fR file will produce severalfiles.If the name of the \fBASN.1\fR module is \fBMODULE\fR the following filesare generated:.I.IP MODULE-types.h.Rwhich contains \fBC\fR structure definitions.The user of the library provides data as a linked list ofthese \fBC\fR data structures and expects to receive data back as a similarlinked list.These data structures are exactly the same as those produced by the original\fBISODE\fR \fIposy\fR so that existing software written for the old \fIposy\fRprogram needs no change.For details on the \fBC\fR data structures types generatedsee the documentation of the original \fIposy\fR program involume 4 Chapter 5 of the \fBISODE\fR manuals..I.IP MODULE_tables.c .RThis file contains the tables generated by the new \fIposy\fR program.These tables consist of three parts, the first which contains the summary of\fBASN.1\fR types.Each type is summarised as an array of a primitive type, \fBstruct pte\fR,for encoding and decoding, and \fBstruct ptpe\fR for printing.As implied there is one array for each type for each of encoding, decoding andprinting as specified when \fIposy\fR is run.The next part contains up to three tables of pointers to these arrays.Each of the three different types of arrays, encoding, decoding and printing,has its own table of pointers.Finally there is the module type definition which contains contains pointersto these tables and some other useful information about the module such as itsname.This module type structure, which is \fBtypedef\fRed to \fBmodtyp\fR,is the only piece of data which is global, all therest of the data is static and is only addressable via the \fBmodtyp\fRdata structure. This provides a kind of object oriented approach to handling the tables.Once you are passed a pointer to an \fBASN.1\fR's \fBmodtyp\fR structureyou can encode, decode and print any of its types by calling the appropriate\fBlibpepsy.a\fR routine with its type number..I.IP MODULE_pre_defs.h.RThis file contains \fB#define\fRs symbol of each of the \fBASN.1\fR typesto its type number, which is used when calling a \fBlibpepsy.a\fR routine.Each symbol is \fB_Ztype-nameMODULE\fR where \fItype-name\fR is the name ofthe type with dashes (\fB-\fR) turned into underscores (\fB_\fR) and\fIMODULE\fR is the name of the module.For example of the \fBASN.1\fR universal type \fIGraphicString\fR wouldhave the \fB#define\fR symbol \fB_ZGraphicStringUNIV\fR.The \fI_Z\fR is prepended to try to make the symbols unique.This file also contains and extern declaration for the \fBmodtyp\fR datafor its module..I.IP MODULE_defs.h.RThis file contains macros for  all the encoding, decoding and printingfunctions that the \fIpepy\fR program would have for these \fBASN.1\fRtypes.This allows much of the code that uses the routines generated by runningthe old \fIposy\fR program and taking its output and running \fIpepy\fR onaugmented \fBASN.1\fR output can be recompiled unchanged.If the code used pointers to these functions it is necessary to change itto pass around the type numbers instead and to call appropriately calla \fBlibpepsy.a\fR library routine with the type number.As pointers to the printing routines in ISODE are passed as argumentsa \fB#define\fR is provided to turn the argument into the pair of arguments,type number and pointer to \fBmodtyp\fR structure, which are needed to allowthe diagnostic printing code to work with no change forthe current \fBISODE\fR stack.This file also contains a \fB#include\fR of the \fIMODULE_pre_defs.h\fR file..PPAs the \fIMODULE-types.h\fR file \fB#include\fR's the \fIMODULE_defs.h\fRfile no further \fB#include\fRs need to be added to the files using theencoding/decoding/printing functions.This means that code written to use posy/pepy system may need no change at alland the only effort required is to change the Makefile to use the pepsysystem.If there is code changes required it would most likely be because functionpointers are used to reference the functions generated by posy.If only the \fIpepy\fR system was used,not posy then pepy,with code placed inside action statements then quite a large amount of workmay be needed to change over to the new system, depending on how large andcomplex the \fIpepy\fR module is..NH 3Outline of the pepsy library..XSOutline of the pepsy library..XE.IP enc.cThis contains the routines that encode data from the \fBC\fR data structuresinto \fBISODE\fR's \fBPElement\fR linked list data structure which ituses for all presentation data.The most important function to pepsy users is \fBenc_f\fR which called toencode a particular type.It is passed the type number and a pointer to \fBmodtyp\fR structure for thatmodule and then the rest of the arguments which are passed to an encodefunction generated by \fIposy\fR/\fIpepy\fR system.See the documentation in Volume 4, "The Applications Cookbook",Section 6.4 called "Pepy Environment".Most of these latter arguments are ignored, only \fBparm\fR and \fBpe\fR,are used..PPContrary to what the \fBISODE\fR documentation says these ignored parametersare hardly ever used by existing code.We have not found a single case where used for encoding a named type,which is all that the user can reference anyway,so we don't see any problems with ignoring these other parameters.Hopefully one day they can be thrown away entirely, until then they areactually passed the the encoding function..PPThe rest of the functions are mostly recursive routines which encode aparticular type of table entry.For example \fBSEQUENCE\fR is encoded by \fBen_seq\fR which may call itselfor others to encode the types from which it is built up.The function \fBen_type\fR builds up a simple type and \fBen_obj\fR encodesa new type (object) and so on with other functions.There are a few utility routines in the file such as \fBsame\fR whichdetermines whether the value is the same as the default value also..IP dec.c This file contains the decoding routines that translatepresentation data into \fBC\fR data structures defined inthe \fBMODULE-types.h\fRis like \fIenc.c\fR.It is very much like the file \fIenc.c\fR except the routines do thereverse tasksThe routines are structured in a very similar way.We have \fBdec_f\fR which is called by the user to decode a typeand like \fBenc_f\fR takes the same arguments as the decoding functionsgenerated by \fIposy\fR with two additions, the type number and a pointerto the \fBmodtyp\fR structure for that module.Likewise the other functions are very much like those of enc.c.IP prnt.cThis file contains the routines that print the presentation data in a formatsimilar to that generated by \fIpepy\fR's printing functions.It's main function \fBprnt_f\fR is takes the same arguments as the printingfunction generated by \fIpepy\fR as well as the now familiar type numberand \fBmodtyp\fR pointer.The functions are modeled on the decoding routines as it has similar job to.The only difference is that instead of storing the decoded datainto a \fBC\fR data structure it is nicely printed out..IP fr.cThis file contains code to free the data structuresdefined in \fBMODULE-types.h\fR.Likewise if the \fB-f\fR flag is given when generating the types file it alsoincludes macros in the types file which replace the freeing functions generatedby ISODE's \fIposy\fR.The function that the user calls us \fBfre_obj\fR which takes a pointer tothe data structure, its decoding table entry and a pointerto the \fBmodtyp\fR structure for the module. The freeing is based on the decoding routines except instead of decoding allit does is free each part of the data structure, which might involve recursivecalls, then it frees the data structure at the end..IP util.cThis contains the utility routines used by more than one of the above files.This is mostly diagnostic routines at the moment, more general routines couldbe included in here.If there is an error at the moment which it can't recover from it just printsout a message on standard error and calls \fBexit\fR.Not perfect and this is something that will need work..IP main.cThis contains code to perform a series of tests on the \fIpepsy\fR librarywhich is a useful check to see whether any of the routines has been brokenby any changes made.It basically loops through a whole series of test cases.Each test case is encoded from some built in test data and then decodedand checked to see if the data has changed in the transfer.If it is compiled with \fI-DPRNT=1\fR the encoded data is also printedout to check the printing routines which generates a vast amount of output.Finally the free routines are used to free the allocated data, although itcan not directly check the free routines to see if they work, it can be usedwith a malloc tracing package to check that the routines work..IP test_table.hThis contains the test cases that \fImain.c\fR program runs.Each entry in the table corresponds to a type.One of the fields is count of how many times that type is to be testedto try out the different possibly data values it might have..IP "pep.h and pepdefs.h"These files contain the definition of types used for the tables that drive theencoding/decoding/printing routines.All the constants used in that table are defined here via \fB#define\fRs.The \fBmodtyp\fR structure is defined in \fIpepdefs.h\fR..IP "t1.py and t2.py"These are test \fBASN.1\fR modules that are used by \fImain.c\fR routinesto check the \fIpepsy\fR library.The file \fIt1.py\fR contains the majority of different types witha few of a different module provided in \fIt2.py\fR.This allows the testing of the code for handling \fBASN.1\fRexternal references, i.e. references to types defined in other, external,modules..NH 3New files in the pepy directory.XSNew files in the pepy directory.XE.IP "etabs.c, dtabs.c and ptabs.c"These files contain the code to generate the encoding/decoding/printing tables.The main routine in \fIetabs.c\fR is \fBtenc_typ\fR which is calledon each \fBASN.1\fR typeto generate an array of entries which describe how to encode that type.See the details section for more information about how thetable entries function.Similarly \fIdtabs.c\fR contains the routine \fBtdec_typ\fR which iscalled on each type to generate its decoding table entries.Likewise \fBtprnt_typ\fR routine generates the arrays of table entries forthe printing tables.This function is in \fIptabs.c\fR..IP "dfns.c"This file contains miscellaneous string handling routines and hash tableroutines that don't really belong anywhere else.Some of the routines could be cleaned up in that they tend not to free memorythey use..IP mine.hThis file contains the definitions for the hash table(s) that are used to keeptrack of the \fBASN.1\fR types.This could probably be done with out a hash table, should anyone want toclean this up, feel welcome.The lookup function is in \fIdfns.c\fR..IP pass2.hThis file has most of the \fB#define\fRs for the table generating program.Most of the prefixes and suffixes of function names and files names are definedhere so, hopefully, the names can be changed by merely changing the definition.This contains most of the important definitions needed by the changesto the \fIposy\fR program needed to generate tables..IP posy.hThis contains the definition of a symbol which is now needed outside of thethe main routine and the yacc file.By putting it here we can include it any file that needs to know it with outputting in any that doesn't need it and with out including all the otherdefinitions that occur in \fIpepy.h\fR.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -