|
#define | ASN1TIMEFIELD_CENTURY 0x01 |
|
#define | ASN1TIMEFIELD_YEAR 0x02 |
|
#define | ASN1TIMEFIELD_MONTH 0x04 |
|
#define | ASN1TIMEFIELD_DAY 0x08 |
|
#define | ASN1TIMEFIELD_WEEK 0x10 |
|
#define | ASN1TIMEFIELD_HOUR 0x20 |
|
#define | ASN1TIMEFIELD_MIN 0x40 |
|
#define | ASN1TIMEFIELD_SEC 0x80 |
|
#define | ASN1TIMEFIELD_Z 0x0100 |
|
#define | ASN1TIMEFIELD_DIFF 0x0200 |
|
#define | ASN1TIMEFIELD_INTERVAL_SE 0x0400 |
|
#define | ASN1TIMEFIELD_DURATION 0x0800 |
|
#define | ASN1TIMEFIELD_INTERVAL_SD 0x1000 |
|
#define | ASN1TIMEFIELD_INTERVAL_DE 0x2000 |
|
#define | ASN1TIMEFIELD_RECUR_INF 0x4000 |
|
#define | ASN1TIMEFIELD_POINT |
|
|
int | rtMakeGeneralizedTime (OSCTXT *pctxt, const OSNumDateTime *dateTime, char **outdata, size_t outdataSize) |
|
int | rtMakeTime (OSCTXT *pctxt, const ASN1Time *timeVal, char **outdata, size_t outdataSize) |
|
int | rtMakeUTCTime (OSCTXT *pctxt, const OSNumDateTime *dateTime, char **outdata, size_t outdataSize) |
|
int | rtParseGeneralizedTime (OSCTXT *pctxt, const char *value, OSNumDateTime *dateTime) |
|
int | rtParseGeneralizedTime2 (OSCTXT *pctxt, const char *value, OSNumDateTime *dateTime, OSBOOL logCanon) |
|
int | rtParseUTCTime (OSCTXT *pctxt, const char *value, OSNumDateTime *dateTime) |
|
int | rtParseUTCTime2 (OSCTXT *pctxt, const char *value, OSNumDateTime *dateTime, OSBOOL logCanon) |
|
int | rtParseTime (OSCTXT *pctxt, const char *value, ASN1Time *timeVal, OSBOOL logCanon) |
|
void | normalizeTimeZone (OSNumDateTime *pvalue) |
|
Utility functions for working with time strings in different formats. rtMake* functions create time strings, rtParse* functions parse time strings. For ASN.1 GeneralizedTime and UTCTime, the C type is used is the OSNumDateTime structure defined in osSysTypes.h. For ASN.1 TIME, the ASN1Time struct is used.
◆ ASN1TIMEFIELD_CENTURY
#define ASN1TIMEFIELD_CENTURY 0x01 |
ASN1TIMEFIELD_ macros are bit flags used to indicate what fields are present in an ASN.1 TIME abstract value.
For year, the value of the year can be used to determine the setting for the Year property (i.e. Basic, Proleptic, Negative, L5, L6, etc..
For intervals, ASN1TIMEFIELD_RECUR_INF is used to signal infinite recurrences while the number of recurrences (0 or more) can be used to distinguish between a non-recurring interval and an R1, R2, etc. recurring interval.
Where fractions may appear, the number of fraction digits can be used to distinguish between no fraction (0 fraction digits) and F1, F2, etc..
◆ ASN1TIMEFIELD_POINT
#define ASN1TIMEFIELD_POINT |
Value: ASN1TIMEFIELD_MONTH | ASN1TIMEFIELD_DAY | ASN1TIMEFIELD_WEEK | \
ASN1TIMEFIELD_HOUR | ASN1TIMEFIELD_MIN | ASN1TIMEFIELD_SEC | \
ASN1TIMEFIELD_Z)
#define ASN1TIMEFIELD_CENTURY
Definition: asn1type.h:526
◆ ASN1Duration
Represents a duration of time. Durations are supposed to have weeks only, or a combination of years, months, ..., seconds. Durations of different precision are considered distinct values, even if their components are equal. "PT6H" and "PT6H0S" are considered distinct values and have a distinct ASN1Duration representations. "P0DT6H" and "PT6H" are considered equal and have the same ASN1Duration represenatation.
◆ ASN1Interval
Represents a recurring or non-recurring interval.
◆ ASN1IntervalDE
Represents an interval with a duration and possibly an end point.
◆ ASN1IntervalSD
Represents an interval with a start point and a duration.
◆ ASN1IntervalSE
Represents an interval with a start point and an end point.
◆ ASN1Time
Represents an ASN.1 TIME abstract value. The settings field indicates what fields are present.
◆ normalizeTimeZone()
void normalizeTimeZone |
( |
OSNumDateTime * |
pvalue | ) |
|
This function normalizes the time zone for the given datetime structure.
- Parameters
-
pvalue | A pointer-to an OSNumDateTime structure. |
◆ rtMakeGeneralizedTime()
int rtMakeGeneralizedTime |
( |
OSCTXT * |
pctxt, |
|
|
const OSNumDateTime * |
dateTime, |
|
|
char ** |
outdata, |
|
|
size_t |
outdataSize |
|
) |
| |
This function creates a time string in ASN.1 GeneralizedTime format as specified in the X.680 ITU-T standard.
- Parameters
-
pctxt | A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
dateTime | A pointer to a date/time structure that contains components of the date and time. |
outdata | A pointer to a pointer to a destination string. If outdataSize is non-zero, it should be a pointer to a pointer to an actual array. Otherwise, the memory will be allocated and the pointer will be stored in the outdata . |
outdataSize | A size of outdata (in octets). If zero, the memory for the outdata will be allocated. If not, the outdata 's size should be big enough to receive the generated time string. Otherwise, error code will be returned. |
- Returns
- Completion status of operation:
- 0 (ASN_OK) = success,
- negative return value is error.
◆ rtMakeTime()
int rtMakeTime |
( |
OSCTXT * |
pctxt, |
|
|
const ASN1Time * |
timeVal, |
|
|
char ** |
outdata, |
|
|
size_t |
outdataSize |
|
) |
| |
This function creates a time string in ASN.1 TIME format as specified in the X.680 ITU-T standard. The string is a canonical value representation as required by CER/DER (note this is not exactly the same as the encoded representation; see X.690:2015 8.26 and 11.9).
- Parameters
-
pctxt | A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
timeVal | A pointer to an ASN1Time structure that contains value. |
outdata | A pointer to a pointer to a destination string. If outdataSize is non-zero, it should be a pointer to a pointer to an actual array. Otherwise, the memory will be allocated and the pointer will be stored in the outdata . |
outdataSize | A size of outdata (in octets). If zero, the memory for the outdata will be allocated. If not, the outdata 's size should be big enough to receive the generated time string. Otherwise, an error code will be returned. |
- Returns
- Completion status of operation:
- 0 (ASN_OK) = success,
- negative return value is error.
◆ rtMakeUTCTime()
int rtMakeUTCTime |
( |
OSCTXT * |
pctxt, |
|
|
const OSNumDateTime * |
dateTime, |
|
|
char ** |
outdata, |
|
|
size_t |
outdataSize |
|
) |
| |
This function creates a time string in ASN.1 UTCTime format as specified in the X.680 ITU-T standard.
- Parameters
-
pctxt | A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
dateTime | A pointer to a date/time structure that contains components of the date and time. |
outdata | A pointer to a pointer to a destination string. If outdataSize is non-zero, it should be a pointer to a pointer to an actual array. Otherwise, the memory will be allocated and the pointer will be stored in the outdata . |
outdataSize | A size of outdata (in octets). If zero, the memory for the outdata will be allocated. If not, the outdata 's size should be big enough to receive the generated time string. Otherwise, error code will be returned. |
- Returns
- Completion status of operation:
- 0 (ASN_OK) = success,
- negative return value is error.
◆ rtParseGeneralizedTime()
int rtParseGeneralizedTime |
( |
OSCTXT * |
pctxt, |
|
|
const char * |
value, |
|
|
OSNumDateTime * |
dateTime |
|
) |
| |
This function parses a time string that is represented in ASN.1 GeneralizedTime format as specified in the X.680 ITU-T standard. It stores the parsed result in a numeric date/time C structure.
If the ASN1CANON or ASN1DER flag is set, and the given value is not a canonical encoding representation, this function will log a non-fatal ASN_E_NOTCANON error (this does not cause a negative return).
- Parameters
-
pctxt | A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | A pointer to the time string to be parsed. |
dateTime | A pointer to the destination structure. |
- Returns
- Completion status of operation:
- 0 (ASN_OK) = success,
- negative return value is error.
◆ rtParseGeneralizedTime2()
int rtParseGeneralizedTime2 |
( |
OSCTXT * |
pctxt, |
|
|
const char * |
value, |
|
|
OSNumDateTime * |
dateTime, |
|
|
OSBOOL |
logCanon |
|
) |
| |
This function is the same as rtParseGeneralizedTime except as follows. When the ASN1CANON or ASN1DER flag is set, if there are canonical violations and no actual errors, this function will return ASN_E_NOTCANON and, if logCanon is true, it will also log non-fatal ASN_E_NOTCANON errors.
- Parameters
-
pctxt | A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | A pointer to the time string to be parsed. |
dateTime | A pointer to the destination structure. |
logCanon | Controls whether to log canonical violations or not. |
- Returns
- Completion status of operation:
- 0 (ASN_OK) = success,
- negative return value is error.
◆ rtParseTime()
int rtParseTime |
( |
OSCTXT * |
pctxt, |
|
|
const char * |
value, |
|
|
ASN1Time * |
timeVal, |
|
|
OSBOOL |
logCanon |
|
) |
| |
Parse an ASN.1 TIME value reprsentation.
If the ASN1CANON or ASN1DER context flag is set, this will also check that the CER/DER canonical value representation is used. If logCanon is TRUE, a violation will result in logging a non-fatal ASN1_E_NOTCANON error. Otherwise, a violation will only result in returning ASN1_E_NOTCANON.
- Parameters
-
pctxt | A pointer to a context structure. This is used for the canonical flags and for logging errors. |
value | The value to parse. |
timeVal | Receives the result of the parsing. |
logCanon | As described above. |
◆ rtParseUTCTime()
int rtParseUTCTime |
( |
OSCTXT * |
pctxt, |
|
|
const char * |
value, |
|
|
OSNumDateTime * |
dateTime |
|
) |
| |
This function parses a time string that is represented in ASN.1 UTCTime format as specified in the X.680 ITU-T standard. It stores the parsed result in a numeric date/time C structure.
If the ASN1CANON or ASN1DER flag is set, and the given value is not a canonical encoding representation, this function will log a non-fatal ASN_E_NOTCANON error (this does not cause a negative return).
- Parameters
-
pctxt | A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | A pointer to the time string to be parsed. |
dateTime | A pointer to the destination date/time structure. |
- Returns
- Completion status of operation:
- 0 (ASN_OK) = success,
- negative return value is error.
◆ rtParseUTCTime2()
int rtParseUTCTime2 |
( |
OSCTXT * |
pctxt, |
|
|
const char * |
value, |
|
|
OSNumDateTime * |
dateTime, |
|
|
OSBOOL |
logCanon |
|
) |
| |
This function is the same as rtParseUTCTime except as follows. When the ASN1CANON or ASN1DER flag is set, if there are canonical violations and no actual errors, this function will return ASN_E_NOTCANON and, if logCanon is true, it will also log non-fatal ASN_E_NOTCANON errors.
- Parameters
-
pctxt | A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. |
value | A pointer to the time string to be parsed. |
dateTime | A pointer to the destination date/time structure. |
logCanon | Controls whether to log canonical violations or not. |
- Returns
- Completion status of operation:
- 0 (ASN_OK) = success,
- negative return value is error.