ASN1C C/C++ Common Runtime  ASN1C v7.3.x
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

#include <ASN1CGeneralizedTime.h>

Inheritance diagram for ASN1CGeneralizedTime:
ASN1CTime ASN1CType

Public Member Functions

EXTRTMETHOD ASN1CGeneralizedTime (OSRTMessageBufferIF &msgBuf, char *&buf, int bufSize, OSBOOL useDerRules=FALSE)
 
EXTRTMETHOD ASN1CGeneralizedTime (OSRTMessageBufferIF &msgBuf, ASN1GeneralizedTime &buf, OSBOOL useDerRules=FALSE)
 
EXTRTMETHOD ASN1CGeneralizedTime (OSRTContext &ctxt, char *&buf, int bufSize, OSBOOL useDerRules=FALSE)
 
EXTRTMETHOD ASN1CGeneralizedTime (OSRTContext &ctxt, ASN1GeneralizedTime &buf, OSBOOL useDerRules=FALSE)
 
 ASN1CGeneralizedTime (const ASN1CGeneralizedTime &original)
 
EXTRTMETHOD int getCentury ()
 
EXTRTMETHOD int setCentury (short century)
 
EXTRTMETHOD int setTime (time_t time, OSBOOL diffTime)
 
const ASN1CGeneralizedTimeoperator= (const ASN1CGeneralizedTime &tm)
 
- Public Member Functions inherited from ASN1CTime
EXTRTMETHOD ASN1CTime (OSRTMessageBufferIF &msgBuf, char *&buf, OSSIZE bufSize, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (OSRTMessageBufferIF &msgBuf, ASN1VisibleString &buf, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (OSRTContext &ctxt, char *&buf, OSSIZE bufSize, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (OSRTContext &ctxt, ASN1VisibleString &buf, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (const ASN1CTime &original)
 
EXTRTMETHOD ~ASN1CTime ()
 
virtual EXTRTMETHOD int getYear ()
 
virtual EXTRTMETHOD int getMonth ()
 
virtual EXTRTMETHOD int getDay ()
 
virtual EXTRTMETHOD int getHour ()
 
virtual EXTRTMETHOD int getMinute ()
 
virtual EXTRTMETHOD int getSecond ()
 
virtual EXTRTMETHOD int getFraction ()
 
virtual EXTRTMETHOD double getFractionAsDouble ()
 
virtual EXTRTMETHOD int getFractionStr (char *const pBuf, size_t bufSize)
 
virtual EXTRTMETHOD int getFractionLen ()
 
virtual EXTRTMETHOD int getDiffHour ()
 
virtual EXTRTMETHOD int getDiffMinute ()
 
virtual EXTRTMETHOD int getDiff ()
 
virtual EXTRTMETHOD OSBOOL getUTC ()
 
virtual EXTRTMETHOD time_t getTime ()
 
void setDER (OSBOOL bvalue)
 
virtual EXTRTMETHOD int setUTC (OSBOOL utc)
 
virtual EXTRTMETHOD int setYear (short year_)
 
virtual EXTRTMETHOD int setMonth (short month_)
 
virtual EXTRTMETHOD int setDay (short day_)
 
virtual EXTRTMETHOD int setHour (short hour_)
 
virtual EXTRTMETHOD int setMinute (short minute_)
 
virtual EXTRTMETHOD int setSecond (short second_)
 
virtual EXTRTMETHOD int setFraction (int fraction, int fracLen=-1)
 
virtual EXTRTMETHOD int setFraction (double frac, int fracLen)
 
virtual EXTRTMETHOD int setFraction (char const *frac)
 
virtual EXTRTMETHOD int setDiffHour (short dhour)
 
virtual EXTRTMETHOD int setDiff (short dhour, short dminute)
 
virtual EXTRTMETHOD int setDiff (short inMinutes)
 
virtual EXTRTMETHOD int parseString (const char *string)
 
virtual EXTRTMETHOD void clear ()
 
virtual EXTRTMETHOD int equals (ASN1CTime &)
 
EXTRTMETHOD OSSIZE getTimeStringLen ()
 
EXTRTMETHOD const char * getTimeString (char *pbuf, OSSIZE bufsize)
 
EXTRTMETHOD const ASN1CTimeoperator= (const ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator== (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator!= (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator> (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator< (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator>= (ASN1CTime &)
 
virtual EXTRTMETHOD OSBOOL operator<= (ASN1CTime &)
 
- Public Member Functions inherited from ASN1CType
EXTRTMETHOD ASN1CType (OSRTMessageBufferIF &msgBuf)
 
EXTRTMETHOD ASN1CType (const ASN1CType &orig)
 
virtual ~ASN1CType ()
 
void append (OSRTDList &llist, void *pdata)
 
OSRTCtxtPtr getContext ()
 
OSCTXTgetCtxtPtr ()
 
char * getErrorText (char *textbuf=(char *) 0, OSSIZE bufsize=0)
 
int getStatus () const
 
void * memAlloc (OSSIZE numocts)
 
void * memAllocZ (OSSIZE numocts)
 
void memFreeAll ()
 
void * memRealloc (void *ptr, OSSIZE numocts)
 
void memReset ()
 
void memFreePtr (void *ptr)
 
void printErrorInfo ()
 
void resetError ()
 
OSBOOL setDiag (OSBOOL value)
 
virtual EXTRTMETHOD int Encode ()
 
virtual EXTRTMETHOD int Decode (OSBOOL free=FALSE)
 
virtual int EncodeTo (OSRTMessageBufferIF &)
 
virtual int DecodeFrom (OSRTMessageBufferIF &, OSBOOL free=TRUE)
 

Protected Member Functions

virtual ASN1TTimegetTimeObj ()
 
virtual const ASN1TTimegetTimeObj () const
 
EXTRTMETHOD ASN1CGeneralizedTime (char *&buf, int bufSize, OSBOOL useDerRules=FALSE)
 
EXTRTMETHOD ASN1CGeneralizedTime (ASN1GeneralizedTime &buf, OSBOOL useDerRules=FALSE)
 
EXTRTMETHOD int compileString ()
 
- Protected Member Functions inherited from ASN1CTime
EXTRTMETHOD void checkCapacity ()
 
EXTRTMETHOD char *& getTimeStringPtr ()
 
EXTRTMETHOD ASN1CTime (char *&buf, OSSIZE bufSize, OSBOOL useDerRules)
 
EXTRTMETHOD ASN1CTime (ASN1VisibleString &buf, OSBOOL useDerRules)
 
- Protected Member Functions inherited from ASN1CType
EXTRTMETHOD ASN1CType ()
 
EXTRTMETHOD ASN1CType (OSRTContext &ctxt)
 
EXTRTMETHOD int setMsgBuf (OSRTMessageBufferIF &msgBuf, OSBOOL initBuf=FALSE)
 
EXTRTMETHOD int setRunTimeKey (const OSOCTET *key, OSSIZE keylen)
 

Protected Attributes

ASN1TGeneralizedTime timeObj
 
- Protected Attributes inherited from ASN1CTime
OSBOOL parsed
 
OSBOOL derRules
 
char *& timeStr
 
OSSIZE strSize
 
- Protected Attributes inherited from ASN1CType
OSRTCtxtPtr mpContext
 
OSRTMessageBufferIF * mpMsgBuf
 

Additional Inherited Members

- Public Types inherited from ASN1CTime
enum  {
  January = 1, Jan = 1, February = 2, Feb = 2,
  March = 3, Mar = 3, April = 4, Apr = 4,
  May = 5, June = 6, Jun = 6, July = 7,
  Jul = 7, August = 8, Aug = 8, September = 9,
  Sep = 9, October = 10, Oct = 10, November = 11,
  Nov = 11, December = 12, Dec = 12
}
 

Detailed Description

ASN.1 GeneralizedTime control class. The ASN1CGeneralizedTime class is derived from the ASN1CTime base class. It is used as the base class for generated control classes for the ASN.1 Generalized Time ([UNIVERSAL 24] IMPLICIT VisibleString) type. This class provides utility methods for operating on the time information referenced by the generated class. This class can also be used inline to operate on the times within generated time string elements in a SEQUENCE, SET, or CHOICE construct. The time string generally is encoded according to ISO 8601 format with some exceptions (see X.680).

Constructor & Destructor Documentation

◆ ASN1CGeneralizedTime() [1/5]

EXTRTMETHOD ASN1CGeneralizedTime::ASN1CGeneralizedTime ( OSRTMessageBufferIF &  msgBuf,
char *&  buf,
int  bufSize,
OSBOOL  useDerRules = FALSE 
)

This constructor creates a time string from a buffer. It does not deep-copy the data, it just assigns the passed array to an internal reference variable. The object will then directly operate on the given data variable.

Parameters
msgBufReference to an OSRTMessage buffer derived object (for example, an ASN1BEREncodeBuffer).
bufA reference pointer to the time string buffer.
bufSizeThe size of the passed buffer, in bytes.
useDerRulesAn OSBOOL value.

◆ ASN1CGeneralizedTime() [2/5]

EXTRTMETHOD ASN1CGeneralizedTime::ASN1CGeneralizedTime ( OSRTMessageBufferIF &  msgBuf,
ASN1GeneralizedTime &  buf,
OSBOOL  useDerRules = FALSE 
)

This constructor creates a time string using the ASN1GeneralizedTime argument. The constructor does not deep-copy the variable, it assigns a reference to it to an internal variable. The object will then directly operate on the given data variable. This form of the constructor is used with a complier-generated time string variable.

Parameters
msgBufReference to an OSRTMessage buffer derived object (for example, an ASN1BEREncodeBuffer).
bufA reference pointer to the time string buffer.
useDerRulesAn OSBOOL value.

◆ ASN1CGeneralizedTime() [3/5]

EXTRTMETHOD ASN1CGeneralizedTime::ASN1CGeneralizedTime ( OSRTContext ctxt,
char *&  buf,
int  bufSize,
OSBOOL  useDerRules = FALSE 
)

This constructor creates a time string from buffer.

It does not deep-copy the data; it just assigns the passed array to an internal reference variable. The object will then directly operate on the given data variable.

Parameters
ctxtReference to an OSRTContext data structure.
bufReference to a pointer to a time string buffer.
bufSizeSize of buffer in bytes.
useDerRulesUse the Distinguished Encoding Rules (DER) to operate on this time value.

◆ ASN1CGeneralizedTime() [4/5]

EXTRTMETHOD ASN1CGeneralizedTime::ASN1CGeneralizedTime ( OSRTContext ctxt,
ASN1GeneralizedTime &  buf,
OSBOOL  useDerRules = FALSE 
)

This constructor creates a time string from an ::ASN1GeneralizedTime object.

It does not deep-copy the data; it just assigns the passed array to an internal reference variable. The object will then directly operate on the given data variable.

Parameters
ctxtReference to an OSRTContext data structure.
bufReference to a pointer to a time string buffer.
useDerRulesUse the Distinguished Encoding Rules (DER) to operate on this time value.

◆ ASN1CGeneralizedTime() [5/5]

ASN1CGeneralizedTime::ASN1CGeneralizedTime ( const ASN1CGeneralizedTime original)
inline

The copy constructor. This does not deep-copy the original value. Instead, it assigns references to the internal components.

Parameters
originalThe original time string object value.

References ASN1CTime::compileString(), ASN1CTime::operator=(), and ASN1CTime::setTime().

Member Function Documentation

◆ compileString()

EXTRTMETHOD int ASN1CGeneralizedTime::compileString ( )
protectedvirtual

Compiles new time string accoring X.680 (clause 41) and ISO 8601. Returns 0, if succeed, or error code, if error.

Returns
0 on success, or an error code otherwise.

Implements ASN1CTime.

◆ getCentury()

EXTRTMETHOD int ASN1CGeneralizedTime::getCentury ( )

This method returns the century part (first two digits) of the year component of the time value.

Parameters
-none
Returns
Century part (first two digits) of the year component is returned if the operation is sucessful. If the operation fails, one of the negative status codes is returned.

◆ setCentury()

EXTRTMETHOD int ASN1CGeneralizedTime::setCentury ( short  century)

This method sets the century part (first two digits) of the year component of the time value.

Parameters
centuryCentury part (first two digits) of the year component.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ setTime()

EXTRTMETHOD int ASN1CGeneralizedTime::setTime ( time_t  time,
OSBOOL  diffTime 
)
virtual

This converts the value of the C built-in type time_t to a time string.

The value is the number of seconds from January 1, 1970. Note that the action of this method may differ for different inherited ASN1CTime Classes.

Parameters
timeThe time value, expressed as a number of seconds from January 1, 1970.
diffTimeTRUE means the difference between local time and UTC time will be calculated; in other case, only local time will be stored.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Implements ASN1CTime.


The documentation for this class was generated from the following file: