本文整理汇总了C++中LOG_RTERR函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_RTERR函数的具体用法?C++ LOG_RTERR怎么用?C++ LOG_RTERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_RTERR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: berDecStrmMatchTag
int berDecStrmMatchTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
OSBOOL advance)
{
int stat;
ASN1TAG parsed_tag;
int parsed_len;
stat = rtxStreamDirectBufCheck (pctxt);
if (stat < 0) return LOG_RTERR (pctxt, stat);
stat = rtxStreamMark (pctxt, 32);
if (stat != 0) return LOG_RTERR (pctxt, stat);
stat = berDecStrmTagAndLen (pctxt, &parsed_tag, &parsed_len);
if (stat != 0) return LOG_RTERR (pctxt, stat);
parsed_tag &= ~TM_CONS;
if ((tag & ~TM_CONS) != parsed_tag) {
rtxStreamReset (pctxt);
#ifndef _COMPACT
berErrAddTagParm (pctxt, tag); /* expected tag */
berErrAddTagParm (pctxt, parsed_tag); /* parsed tag */
#endif
return RTERR_IDNOTFOU;
}
else {
if (len_p != 0) *len_p = parsed_len;
if (!advance) {
stat = rtxStreamReset (pctxt);
if (stat != 0) return LOG_RTERR (pctxt, stat);
}
}
return 0;
}
示例2: asn1PD_RUA_CauseProtocol
EXTERN int asn1PD_RUA_CauseProtocol (OSCTXT* pctxt, RUA_CauseProtocol* pvalue)
{
int stat = 0;
OSUINT32 ui;
OSBOOL extbit = FALSE;
/* extension bit */
stat = PD_BIT (pctxt, &extbit);
if (stat != 0) return LOG_RTERR (pctxt, stat);
if (extbit) {
stat = pd_SmallNonNegWholeNumber (pctxt, &ui);
if (stat != 0) return LOG_RTERR (pctxt, stat);
*pvalue = 0x7fffffff;
}
else {
stat = pd_ConsUnsigned (pctxt, &ui, 0, OSUINTCONST(6));
if (stat != 0) return LOG_RTERR (pctxt, stat);
switch (ui) {
case 0: *pvalue = RUA_transfer_syntax_error; break;
case 1: *pvalue = RUA_abstract_syntax_error_reject; break;
case 2: *pvalue = RUA_abstract_syntax_error_ignore_and_notify; break;
case 3: *pvalue = RUA_message_not_compatible_with_receiver_state; break;
case 4: *pvalue = RUA_semantic_error; break;
case 5: *pvalue = RUA_unspecified_2; break;
case 6: *pvalue = RUA_abstract_syntax_error_falsely_constructed_message; break;
default: return LOG_RTERR (pctxt, RTERR_INVENUM);
}
}
return (stat);
}
示例3: asn1PD_RUA_Establishment_Cause
EXTERN int asn1PD_RUA_Establishment_Cause (OSCTXT* pctxt, RUA_Establishment_Cause* pvalue)
{
int stat = 0;
OSUINT32 ui;
OSBOOL extbit = FALSE;
/* extension bit */
stat = PD_BIT (pctxt, &extbit);
if (stat != 0) return LOG_RTERR (pctxt, stat);
if (extbit) {
stat = pd_SmallNonNegWholeNumber (pctxt, &ui);
if (stat != 0) return LOG_RTERR (pctxt, stat);
*pvalue = 0x7fffffff;
}
else {
stat = pd_ConsUnsigned (pctxt, &ui, 0, OSUINTCONST(1));
if (stat != 0) return LOG_RTERR (pctxt, stat);
switch (ui) {
case 0: *pvalue = RUA_emergency_call; break;
case 1: *pvalue = RUA_normal_call; break;
default: return LOG_RTERR (pctxt, RTERR_INVENUM);
}
}
return (stat);
}
示例4: rtMakeGeneralizedTime
EXTRTMETHOD int rtMakeGeneralizedTime (OSCTXT* pctxt, const OSNumDateTime* dateTime,
char** outdata, size_t outdataSize)
{
char dateTimeStr[46];
int j;
double frac;
if (!rtxDateTimeIsValid (dateTime))
return LOG_RTERR(pctxt, RTERR_INVFORMAT);
/* YYYYMMDDHH[MM[SS[(.|,)SSSS]]][TZD] */
j = sprintf (dateTimeStr, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d",
dateTime->year, dateTime->mon, dateTime->day,
dateTime->hour, dateTime->min, (int)dateTime->sec);
frac = dateTime->sec - (int)dateTime->sec;
if (frac > 0.00000001) {
char tmpbuf[32]; int i, len;
sprintf (tmpbuf, "%.6f", frac);
len = strlen (tmpbuf);
/* cut trailing zeros off frac part */
for (i = len - 1; i > 0; i--) {
if (tmpbuf [i] == '0')
tmpbuf [i] = '\0';
else
break;
}
if (i > 2) {
strcat (dateTimeStr, ".");
strcat (dateTimeStr, tmpbuf + 2);
}
}
if (dateTime->tz_flag) {
dateTimeStr [j++] = 'Z';
dateTimeStr [j] = '\0';
}
else if (dateTime->tzo != 0) {
char tzd = (dateTime->tzo < 0) ? '-' : '+';
int tzo = dateTime->tzo;
if (tzo < 0) tzo *= -1;
sprintf (dateTimeStr + j, "%c%02d%02d", tzd, tzo/60, tzo%60);
}
if (outdataSize == 0) {
*outdata = (char*) rtxMemAlloc (pctxt, strlen(dateTimeStr)+1);
if (0 == *outdata)
return LOG_RTERR (pctxt, RTERR_NOMEM);
}
else {
size_t size = strlen (dateTimeStr);
if (outdataSize <= size)
return LOG_RTERR (pctxt, RTERR_STROVFLW);
}
strcpy (*outdata, dateTimeStr);
return (0);
}
示例5: asn1PD_RUA_CauseRadioNetwork
EXTERN int asn1PD_RUA_CauseRadioNetwork (OSCTXT* pctxt, RUA_CauseRadioNetwork* pvalue)
{
int stat = 0;
OSUINT32 ui;
OSBOOL extbit = FALSE;
/* extension bit */
stat = PD_BIT (pctxt, &extbit);
if (stat != 0) return LOG_RTERR (pctxt, stat);
if (extbit) {
stat = pd_SmallNonNegWholeNumber (pctxt, &ui);
if (stat != 0) return LOG_RTERR (pctxt, stat);
*pvalue = 0x7fffffff;
}
else {
stat = pd_ConsUnsigned (pctxt, &ui, 0, OSUINTCONST(3));
if (stat != 0) return LOG_RTERR (pctxt, stat);
switch (ui) {
case 0: *pvalue = RUA_normal; break;
case 1: *pvalue = RUA_connect_failed; break;
case 2: *pvalue = RUA_network_release; break;
case 3: *pvalue = RUA_unspecified; break;
default: return LOG_RTERR (pctxt, RTERR_INVENUM);
}
}
return (stat);
}
示例6: berDecStrmReal
int berDecStrmReal (OSCTXT *pctxt, OSREAL *object_p,
ASN1TagType tagging, int length)
{
OSRTBuffer savedBuf;
OSOCTET tmpbuf[16];
register int stat = 0;
if (tagging == ASN1EXPL) {
if ((stat = berDecStrmMatchTag (pctxt, ASN_ID_REAL, &length, TRUE)) != 0)
/* RTERR_IDNOTFOU will be logged later, by the generated code,
or reset by rtxErrReset (for optional seq elements). */
return (stat == RTERR_IDNOTFOU) ? stat : LOG_RTERR (pctxt, stat);
}
/* Read encoded value into memory */
if (length > sizeof(tmpbuf)) {
return LOG_RTERR (pctxt, RTERR_TOOBIG);
}
stat = rtxStreamRead (pctxt, tmpbuf, length);
if (stat < 0) return LOG_RTERR (pctxt, stat);
/* Decode */
memcpy (&savedBuf, &pctxt->buffer, sizeof(OSRTBuffer));
rtxInitContextBuffer (pctxt, tmpbuf, length);
stat = xd_real (pctxt, object_p, ASN1IMPL, length);
/* Reset context buffer */
memcpy (&pctxt->buffer, &savedBuf, sizeof(OSRTBuffer));
return stat;
}
示例7: rtxCheckBuffer
EXTRTMETHOD int rtxWriteBytes
(OSCTXT* pctxt, const OSOCTET* pdata, size_t nocts)
{
if (nocts > 0) {
if (!OSRTISSTREAM (pctxt)) {
int stat = rtxCheckBuffer (pctxt, nocts);
if (0 == stat) {
OSCRTLMEMCPY (&pctxt->buffer.data[pctxt->buffer.byteIndex],
pdata, nocts);
pctxt->buffer.byteIndex += nocts;
}
else return LOG_RTERR (pctxt, stat);
}
#ifndef _NO_STREAM
else {
if (OSRTSTREAM_ID (pctxt) != OSRTSTRMID_DIRECTBUF &&
!(OSRTSTREAM_FLAGS (pctxt) & OSRTSTRMF_UNBUFFERED))
{
int stat = rtxStreamDirectBufCreate (pctxt);
if (stat != 0) return LOG_RTERR (pctxt, stat);
}
return rtxStreamWrite (pctxt, pdata, nocts);
}
#endif
}
LCHECKX (pctxt);
return 0;
}
示例8: rtxStreamSocketCreateWriter
EXTRTMETHOD int rtxStreamSocketCreateWriter (OSCTXT* pctxt, const char* host, int port)
{
int i, stat;
OSRTSOCKET socket;
if (0 != pctxt->pStream) {
return LOG_RTERR (pctxt, RTERR_STRMINUSE);
}
stat = rtxSocketCreate (&socket);
if (0 != stat) return LOG_RTERR (pctxt, stat);
RTDIAG3 (pctxt, "Connecting to %s:%i..", host, port);
for (i = 0; i < MAX_CONNECT_ATTEMPTS; i++) {
stat = rtxSocketConnect (socket, host, port);
if (0 != stat) {
if (i + 1 == MAX_CONNECT_ATTEMPTS) {
RTDIAG2 (pctxt, "\nConnection failed, error code is %i\n", stat);
return LOG_RTERR (pctxt, stat);
}
}
else break;
}
RTDIAG1 (pctxt, "\nConnection established.\n");
rtxStreamInit (pctxt);
stat = rtxStreamSocketAttach (pctxt, socket, OSRTSTRMF_OUTPUT);
if (0 != stat) return LOG_RTERR (pctxt, stat);
return 0;
}
示例9: xd_32BitCharStr
int xd_32BitCharStr (OSCTXT* pctxt, Asn132BitCharString* object_p,
ASN1TagType tagging, ASN1TAG tag, int length)
{
OSUINT32 i;
OSINT32 stat = 0, isConstructedTag;
OSOCTET* data = 0;
OSUINT32 nchars = 0;
OS32BITCHAR* data32 = 0;
if (tagging == ASN1EXPL) {
if ((stat = xd_match1 (pctxt, ASN1TAG2BYTE(tag), &length)) < 0)
/* RTERR_IDNOTFOU will be logged later, by the generated code,
or reset by rtxErrReset (for optional seq elements). */
return (stat == RTERR_IDNOTFOU) ? stat : LOG_RTERR (pctxt, stat);
}
isConstructedTag = (int)((pctxt->flags & ASN1CONSTAG) != 0);
if (0 == length) {
nchars = 0;
data32 = 0;
}
else {
int size, ll = 0;
/* For an indefinite length message, need to get the actual */
/* length by parsing tags until the end of the message is */
/* reached.. */
if (length == ASN_K_INDEFLEN) { /* indefinite length message */
if ((stat = xd_consStrIndefLenAndSize (pctxt, TM_UNIV|ASN_ID_OCTSTR,
&ll, &size)) != 0)
return LOG_RTERR (pctxt, stat);
}
else ll = size = length;
data = (OSOCTET*) rtxMemAlloc (pctxt, ll);
data32 = (OS32BITCHAR*)data;
if (0 != data) {
ll = size;
if ((stat = xd_octstr_s
(pctxt, data, (OSUINT32*) &ll, ASN1IMPL, size)) != 0)
return LOG_RTERR_AND_FREE_MEM (pctxt, stat, data);
nchars = ll / 4;
for (i = 0; i < nchars; i++, data += 4) {
data32[i] = (OS32BITCHAR) (((data[0] * 256) + data[1]) *
65536UL + (((data[2] * 256) + data[3])));
}
}
else
return LOG_RTERR (pctxt, RTERR_NOMEM);
}
if (isConstructedTag && length == ASN_K_INDEFLEN) {
if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2);
else return LOG_RTERR_AND_FREE_MEM (pctxt, ASN_E_INVLEN, data);
}
object_p->data = data32;
object_p->nchars = nchars;
return 0;
}
示例10: xerEncAscCharStr
int xerEncAscCharStr (OSCTXT* pctxt,
const char* pvalue,
const char* elemName)
{
int stat;
/* Element name must be specified because this function could be */
/* invoked to handle any of the useful character string types. */
if (0 == elemName) return LOG_RTERR (pctxt, RTERR_INVPARAM);
/* Encode start element */
stat = xerEncStartElement (pctxt, elemName, 0);
if (stat != 0) return LOG_RTERR (pctxt, stat);
pctxt->state = XERDATA;
/* Loop through all characters and convert special characters into */
/* XML escape sequences. */
stat = xerPutCharStr (pctxt, pvalue, strlen (pvalue));
if (stat != 0) return LOG_RTERR (pctxt, stat);
/* Encode end element */
stat = xerEncEndElement (pctxt, elemName);
if (stat != 0) return LOG_RTERR (pctxt, stat);
return 0;
}
示例11: PU_NEWFIELD
EXTPERMETHOD int PD_CONSINTFUNC
(OSCTXT* pctxt, OSINTTYPE* pvalue, OSINTTYPE lower, OSINTTYPE upper)
{
OSINTTYPE range_value;
OSINTTYPE adjusted_value;
int stat;
/* Check for special case: if lower is 0 and upper is OSINTMAX, */
/* set range to OSINTMAX; otherwise to upper - lower + 1 */
range_value = (lower == 0 && upper == OSINTMAX) ?
OSINTMAX : upper - lower + 1;
PU_NEWFIELD (pctxt, "ConsUnsigned");
if (lower != upper) {
stat = PD_CONSWHOLENUMBER (pctxt, &adjusted_value, range_value);
if (stat == 0) {
*pvalue = adjusted_value + lower;
/* Verify value is within given range */
if (*pvalue < lower || *pvalue > upper) {
rtxErrAddElemNameParm (pctxt);
RTXERRADDINTPARM (pctxt, *pvalue);
return LOG_RTERR (pctxt, RTERR_CONSVIO);
}
}
else return LOG_RTERR (pctxt, stat);
}
else *pvalue = lower;
PU_SETBITCOUNT (pctxt);
return 0;
}
示例12: strcmp
EXTXMLMETHOD int rtAsn1XmlEncOpenType
(OSCTXT *pctxt, const OSOCTET* data, OSUINT32 nocts,
const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
{
OSUTF8CHAR* qname = 0;
int stat;
if (0 != isBinaryData (data, nocts)) {
const OSUTF8CHAR *ename = (elemName == 0 || strcmp ("", elemName) == 0 ) ?
OSUTF8("binext") : elemName;
qname = rtXmlNewQName (pctxt, ename, nsPrefix);
if (0 != qname) {
stat = rtXmlEncStartElement (pctxt, qname, 0, 0, TRUE);
if (stat != 0) return LOG_RTERR (pctxt, stat);
}
else return RTERR_NOMEM;
if (0 != data && nocts > 0) {
stat = rtXmlEncHexStrValue (pctxt, nocts, data);
pctxt->state = OSXMLDATA;
if (stat != 0) return LOG_RTERR (pctxt, stat);
}
if (0 != qname) {
stat = rtXmlEncEndElement (pctxt, qname, 0);
if (stat != 0) return LOG_RTERR (pctxt, stat);
rtxMemFreePtr (pctxt, qname);
}
}
else {
if (0 != elemName) {
qname = rtXmlNewQName (pctxt, elemName, nsPrefix);
if (0 != qname) {
stat = rtXmlEncStartElement (pctxt, qname, 0, 0, TRUE);
if (stat != 0) return LOG_RTERR (pctxt, stat);
}
else return RTERR_NOMEM;
}
if (0 != data && nocts > 0) {
OSRTSAFEMEMCPY (pctxt, data, nocts);
pctxt->state = OSXMLDATA;
}
if (0 != qname) {
stat = rtXmlEncEndElement (pctxt, qname, 0);
if (stat != 0) return LOG_RTERR (pctxt, stat);
rtxMemFreePtr (pctxt, qname);
}
}
return 0;
}
示例13: xd_len
int xd_len (OSCTXT *pctxt, int *len_p)
{
OSOCTET b = XD_FETCH1 (pctxt);
register int i;
*len_p = 0;
if (b > 0x80) {
i = b & 0x7F;
if (i > 4)
return LOG_RTERR (pctxt, ASN_E_INVLEN);
for (*len_p = 0; i > 0; i--) {
b = XD_FETCH1 (pctxt);
*len_p = (*len_p * 256) + b;
}
}
else if (b == 0x80) *len_p = ASN_K_INDEFLEN;
else *len_p = b;
/* Length is not indefinite length */
if (*len_p != ASN_K_INDEFLEN) {
if (*len_p < 0 ||
*len_p > (int)(pctxt->buffer.size - pctxt->buffer.byteIndex))
return LOG_RTERR (pctxt, ASN_E_INVLEN);
}
return (0);
}
示例14: berDecStrmInt8
int berDecStrmInt8 (OSCTXT *pctxt, OSINT8 *object_p,
ASN1TagType tagging, int length)
{
register int stat = 0;
if (tagging == ASN1EXPL) {
stat = berDecStrmMatchTag (pctxt, ASN_ID_INT, &length, TRUE);
/* RTERR_IDNOTFOU will be logged later, by the generated code,
or reset by rtxErrReset (for optional seq elements). */
if (stat != 0)
return (stat == RTERR_IDNOTFOU) ? stat : LOG_RTERR (pctxt, stat);
}
/* Make sure integer will fit in target variable */
if (length > (sizeof(OSINT8))) {
return LOG_RTERR (pctxt, RTERR_TOOBIG);
}
else if (length <= 0)
return LOG_RTERR (pctxt, ASN_E_INVLEN); /* note: indef len not allowed */
/* Copy first byte into a signed char variable and assign it to */
/* object. This should handle sign extension in the case of a */
/* negative number.. */
stat = rtxStreamRead (pctxt, (OSOCTET*)object_p, 1);
if (stat < 0) return LOG_RTERR (pctxt, stat);
return 0;
}
示例15: xerDecUInt64
int xerDecUInt64 (OSCTXT* pctxt, OSUINT64* pvalue)
{
XMLCHAR* inpdata = (XMLCHAR*) ASN1BUFPTR (pctxt);
int i;
OSBOOL minus = FALSE;
register OSUINT64 value = 0, prevVal = 0;
*pvalue = 0;
/* Consume leading white space */
for (i = 0; inpdata[i] != 0; i++) {
if (!OS_ISSPACE (inpdata[i])) break;
}
/* Convert Unicode characters to an integer value */
for ( ; inpdata[i] != 0; i++, prevVal = value) {
if (OS_ISDIGIT (inpdata[i]))
value = (value * 10) + (inpdata[i] - '0');
else
return LOG_RTERR (pctxt, RTERR_INVCHAR);
if (value/10 != prevVal) /* test for int overflow AB, 09/27/02 */
return LOG_RTERR (pctxt, RTERR_TOOBIG);
}
*pvalue = value;
return (0);
}