/** * Decodes the http uri path. * * @param p0 the destination model (Hand over as reference!) * @param p1 the destination model count * @param p2 the destination model size * @param p3 the destination details (Hand over as reference!) * @param p4 the destination details count * @param p5 the destination details size * @param p6 the current position (Hand over as reference!) * @param p7 the remaining count */ void decode_http_uri_path(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7) { if (p7 != *NULL_POINTER_MEMORY_MODEL) { int* rem = (int*) p7; if (p6 != *NULL_POINTER_MEMORY_MODEL) { void** pos = (void**) p6; log_terminated_message((void*) DEBUG_LEVEL_LOG_MODEL, (void*) L"Decode http uri path."); // The element. void* e = *pos; int ec = *NUMBER_0_INTEGER_MEMORY_MODEL; // The break flag. int b = *NUMBER_0_INTEGER_MEMORY_MODEL; while (*TRUE_BOOLEAN_MEMORY_MODEL) { if (*rem <= *NUMBER_0_INTEGER_MEMORY_MODEL) { break; } select_http_uri_path(p0, p1, p2, p3, p4, p5, (void*) &b, p6, p7); if (b != *NUMBER_0_INTEGER_MEMORY_MODEL) { break; } else { // Increment element count. ec++; } } // The path is always added, independent from whether // or not a query or fragment separator was found. // // If a query or fragment was found right at // the first position, then no path was given. // In this case, a path with empty value is added. append_part(p0, p1, p2, (void*) CYBOI_PATH_URI_NAME, (void*) CYBOI_PATH_URI_NAME_COUNT, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT, e, (void*) &ec, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL); } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode http uri path. The current position is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode http uri path. The remaining count is null."); } }
/** * Decodes the authority password. * * @param p0 the destination model (Hand over as reference!) * @param p1 the destination model count * @param p2 the destination model size * @param p3 the destination details (Hand over as reference!) * @param p4 the destination details count * @param p5 the destination details size * @param p6 the current position (Hand over as reference!) * @param p7 the remaining count */ void decode_authority_password(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7) { if (p7 != *NULL_POINTER_MEMORY_MODEL) { int* rem = (int*) p7; if (p6 != *NULL_POINTER_MEMORY_MODEL) { void** pos = (void**) p6; log_terminated_message((void*) DEBUG_LEVEL_LOG_MODEL, (void*) L"Decode authority password."); // The element. void* e = *pos; int ec = *NUMBER_0_INTEGER_MEMORY_MODEL; // The break flag. int b = *NUMBER_0_INTEGER_MEMORY_MODEL; while (*NUMBER_1_INTEGER_MEMORY_MODEL) { if (*rem <= *NUMBER_0_INTEGER_MEMORY_MODEL) { break; } select_authority_password(p0, p1, p2, p3, p4, p5, (void*) &b, p6, p7); if (b != *NUMBER_0_INTEGER_MEMORY_MODEL) { break; } else { // Increment element count. ec++; } } // An own file was created to decode the password, // since it might be encrypted and need special handling. // Add special source code here, if necessary. append_part(p0, p1, p2, (void*) CYBOI_PASSWORD_AUTHORITY_NAME, (void*) CYBOI_PASSWORD_AUTHORITY_NAME_COUNT, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT, e, (void*) &ec, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL); } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode authority password. The current position is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode authority password. The remaining count is null."); } }
void create_test_database(std::string dir, std::string dbfile) { const std::string index1path = dir + "/index1.idx"; const std::string index2path = dir + "/index2.idx"; boost::shared_ptr< BinnedIndex > index = make_index< IIRegionEncoder, int >(IIRegionEncoderConfig(), SMALL_DOMAIN); boost::shared_ptr< IndexIO > iio = boost::make_shared< POSIXIndexIO >(); iio->open(index1path, IndexOpenMode::WRITE); append_part(*iio, *index, 0*SMALL_DOMAIN.size()); append_part(*iio, *index, 1*SMALL_DOMAIN.size()); append_part(*iio, *index, 2*SMALL_DOMAIN.size()); iio->close(); iio->open(index2path, IndexOpenMode::WRITE); append_part(*iio, *index, 0*SMALL_DOMAIN.size()); append_part(*iio, *index, 1*SMALL_DOMAIN.size()); iio->close(); Database db; db.add_variable("var1", boost::none, boost::make_optional(index1path)); db.add_variable("var2", boost::none, boost::make_optional(index2path)); db.save_to_file(dbfile); }
/** * Converts the given characters to wide characters and * appends them to the destination. * * @param p0 the destination (Hand over as reference!) * @param p1 the destination count * @param p2 the destination size * @param p3 the source name * @param p4 the source name count * @param p5 the source abstraction * @param p6 the source abstraction count * @param p7 the source model * @param p8 the source model count * @param p9 the source details * @param p10 the source details count */ void decode_http_request_protocol_append_part(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8, void* p9, void* p10) { // The serialised wide character array. void* s = *NULL_POINTER_MEMORY_MODEL; void* sc = *NULL_POINTER_MEMORY_MODEL; void* ss = *NULL_POINTER_MEMORY_MODEL; // Allocate serialised wide character array. allocate_model((void*) &s, (void*) &sc, (void*) &ss, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); // Decode encoded character array into serialised wide character array. decode_utf_8_unicode_character_vector((void*) &s, sc, ss, p7, p8); append_part(p0, p1, p2, p3, p4, p5, p6, s, sc, p9, p10); // Deallocate serialised wide character array. deallocate_model((void*) &s, (void*) &sc, (void*) &ss, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); }
static void doline(struct rfc2045 *p) { size_t cnt=p->workbuflen; char *c=p->workbuf; size_t n=cnt-1; /* Strip \n (we always get at least a \n here) */ struct rfc2045 *newp; struct rfc2045ac *rwp=p->rfc2045acptr; unsigned num_levels=0; size_t k; int bit8=0; if (p->numparts > MAXPARTS) { p->rfcviolation |= RFC2045_ERR2COMPLEX; return; } for (k=0; k<cnt; k++) { if (c[k] == 0) c[k]=' '; if (c[k] & 0x80) bit8=1; } if (n && c[n-1] == '\r') /* Strip trailing \r */ --n; /* Before the main drill down loop before, look ahead and see if we're ** in a middle of a form-data section. */ for (newp=p; newp->lastpart && !newp->lastpart->workclosed; newp=newp->lastpart, ++num_levels) { if (ContentBoundary(newp) == 0 || newp->workinheader) continue; if (newp->lastpart->informdata) { p=newp->lastpart; p->informdata=0; break; } } /* Drill down until we match a boundary, or until we've reached the last RFC2045 section that has been opened. */ while (p->lastpart) { size_t l; const char *cb; if (p->lastpart->workclosed) { update_counts(p, p->endpos+cnt, p->endpos+n, 1); return; } /* Leftover trash -- workclosed is set when the final ** terminating boundary has been seen */ /* content_boundary may be set before the entire header ** has been seen, so continue drilling down in that case */ cb=ContentBoundary(p); if (cb == 0 || p->workinheader) { p=p->lastpart; ++num_levels; continue; } l=strlen(cb); if (c[0] == '-' && c[1] == '-' && n >= 2+l && strncasecmp(cb, c+2, l) == 0) { if (rwp && (!p->lastpart || !p->lastpart->isdummy)) (*rwp->end_section)(); /* Ok, we've found a boundary */ if (n >= 4+l && strncmp(c+2+l, "--", 2) == 0) { /* Last boundary */ p->lastpart->workclosed=1; update_counts(p, p->endpos+cnt, p->endpos+cnt, 1); return; } /* Create new RFC2045 section */ newp=append_part(p, p->endpos+cnt); update_counts(p, p->endpos+cnt, p->endpos+n, 1); /* The new RFC2045 section is MIME compliant */ if ((newp->mime_version=strdup(p->mime_version)) == 0) rfc2045_enomem(); return; } p=p->lastpart; ++num_levels; } /* Ok, we've found the RFC2045 section that we're working with. ** No what? */ if (! p->workinheader) { /* Processing body, just update the counts. */ size_t cnt_update=cnt; if (bit8 && !p->content_8bit && (p->rfcviolation & RFC2045_ERR8BITCONTENT) == 0) { struct rfc2045 *q; for (q=p; q; q=q->parent) q->rfcviolation |= RFC2045_ERR8BITCONTENT; } /* ** In multiparts, the final newline in a part belongs to the ** boundary, otherwise, include it in the text. */ if (p->parent && p->parent->content_type && strncasecmp(p->parent->content_type, "multipart/", 10) == 0) cnt_update=n; if (!p->lastpart || !p->lastpart->workclosed) { if (rwp && !p->isdummy) (*rwp->section_contents)(c, cnt); update_counts(p, p->endpos+cnt, p->endpos+cnt_update, 1); } return; } if (bit8 && (p->rfcviolation & RFC2045_ERR8BITHEADER) == 0) { struct rfc2045 *q; for (q=p; q; q=q->parent) q->rfcviolation |= RFC2045_ERR8BITHEADER; } /* In the header */ if ( n == 0 ) /* End of header, body begins. Parse header. */ { do_header(p); /* Clean up any left over header line */ p->workinheader=0; /* Message body starts right here */ p->startbody=p->endpos+cnt; update_counts(p, p->startbody, p->startbody, 1); --p->nbodylines; /* Don't count the blank line */ /* Discard content type and boundary if I don't understand ** this MIME flavor. */ if (!RFC2045_ISMIME1(p->mime_version)) { set_string(&p->content_type, 0); rfc2045_freeattr(p->content_type_attr); p->content_type_attr=0; set_string(&p->content_disposition, 0); rfc2045_freeattr(p->content_disposition_attr); p->content_disposition_attr=0; if (p->boundary) { free(p->boundary); p->boundary=0; } } /* Normally, if we don't have a content_type, default it ** to text/plain. However, if the multipart type is ** multipart/digest, it is message/rfc822. */ if (RFC2045_ISMIME1(p->mime_version) && !p->content_type) { char *q="text/plain"; if (p->parent && p->parent->content_type && strcmp(p->parent->content_type, "multipart/digest") == 0) q="message/rfc822"; set_string(&p->content_type, q); } /* If this is not a multipart section, we don't want to ** hear about any boundaries */ if (!p->content_type || strncmp(p->content_type, "multipart/", 10)) { if (p->boundary) free(p->boundary); p->boundary=0; } /* If this section's a message, we will expect to see ** more RFC2045 stuff, so create a nested RFC2045 structure, ** and indicate that we expect to see headers. */ if (p->content_type && strcmp(p->content_type, "message/rfc822") == 0) { newp=append_part_noinherit(p, p->startbody); newp->workinheader=1; return; } /* ** If this is a multipart message (boundary defined), ** create a RFC2045 structure for the pseudo-section ** that precedes the first boundary line. */ if (ContentBoundary(p)) { newp=append_part(p, p->startbody); newp->workinheader=0; newp->isdummy=1; /* It's easier just to create it. */ return; } if (rwp) (*rwp->start_section)(p); return; } /* RFC822 header continues */ update_counts(p, p->endpos + cnt, p->endpos+n, 1); /* If this header line starts with a space, append one space ** to the saved contents of the previous line, and append this ** line to it. */ if (isspace((int)(unsigned char)*c)) { rfc2045_add_buf(&p->header, &p->headersize, &p->headerlen, " ", 1); } else { /* Otherwise the previous header line is complete, so process it */ do_header(p); p->headerlen=0; } /* Save this line in the header buffer, because the next line ** could be a continuation. */ rfc2045_add_buf( &p->header, &p->headersize, &p->headerlen, c, n); }
/** * Decodes the authority username. * * @param p0 the destination model (Hand over as reference!) * @param p1 the destination model count * @param p2 the destination model size * @param p3 the destination details (Hand over as reference!) * @param p4 the destination details count * @param p5 the destination details size * @param p6 the current position (Hand over as reference!) * @param p7 the remaining count */ void decode_authority_username(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7) { if (p7 != *NULL_POINTER_MEMORY_MODEL) { int* rem = (int*) p7; if (p6 != *NULL_POINTER_MEMORY_MODEL) { void** pos = (void**) p6; log_terminated_message((void*) DEBUG_LEVEL_LOG_MODEL, (void*) L"Decode authority username."); // The element. void* e = *pos; int ec = *NUMBER_0_INTEGER_MEMORY_MODEL; // The break flag. int b = *NUMBER_0_INTEGER_MEMORY_MODEL; while (*TRUE_BOOLEAN_MEMORY_MODEL) { if (*rem <= *NUMBER_0_INTEGER_MEMORY_MODEL) { break; } select_authority_username(p0, p1, p2, p3, p4, p5, (void*) &b, p6, p7); if (b != *NUMBER_0_INTEGER_MEMORY_MODEL) { break; } else { // Increment element count. ec++; } } // // If the username-password separator : was NOT found, // then no password was given. // In this case, the source represents a username only. // // If the username-password separator : WAS found, // then a password was given. // In this case, the password was already decoded // inside the "select_authority_username" function. // append_part(p0, p1, p2, (void*) CYBOI_USERNAME_AUTHORITY_NAME, (void*) CYBOI_USERNAME_AUTHORITY_NAME_COUNT, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT, e, (void*) &ec, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL); } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode authority username. The current position is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode authority username. The remaining count is null."); } }
/** * Decodes the xml attribute. * * @param p0 the destination details (Hand over as reference!) * @param p1 the destination details count * @param p2 the destination details size * @param p3 the has content flag * @param p4 the is empty flag * @param p5 the current position (Hand over as reference!) * @param p6 the remaining count */ void decode_xml_attribute(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6) { if (p6 != *NULL_POINTER_MEMORY_MODEL) { int* rem = (int*) p6; if (p5 != *NULL_POINTER_MEMORY_MODEL) { void** pos = (void**) p5; if (p4 != *NULL_POINTER_MEMORY_MODEL) { int* ie = (int*) p4; if (p3 != *NULL_POINTER_MEMORY_MODEL) { int* hc = (int*) p3; if (p0 != *NULL_POINTER_MEMORY_MODEL) { void** dd = (void**) p0; log_terminated_message((void*) DEBUG_LEVEL_LOG_MODEL, (void*) L"Decode xml attribute."); // The source attribute name. void* an = *NULL_POINTER_MEMORY_MODEL; int anc = *NUMBER_0_INTEGER_MEMORY_MODEL; // The source attribute value. void* av = *NULL_POINTER_MEMORY_MODEL; int avc = *NUMBER_0_INTEGER_MEMORY_MODEL; decode_xml_attribute_name((void*) &an, (void*) &anc, p5, p6); decode_xml_attribute_value((void*) &av, (void*) &avc, p5, p6); append_part(p0, p1, p2, an, (void*) &anc, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT, av, (void*) &avc, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL); // The has attribute flag. // CAUTION! This HAS TO BE a local variable, because the function // may be called recursively and if the flag were handed over // as argument to this function, then it would have an initial value // from a previous call of this function, which might lead to wrong results. int ha = *NUMBER_0_INTEGER_MEMORY_MODEL; while (*TRUE_BOOLEAN_MEMORY_MODEL) { if (*rem <= *NUMBER_0_INTEGER_MEMORY_MODEL) { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode xml attribute. The remaining count is zero or smaller."); break; } select_xml_attribute_begin_or_tag_end((void*) &ha, p3, p4, p5, p6); if (ha != *NUMBER_0_INTEGER_MEMORY_MODEL) { // A space character as indicator of subsequent attributes was detected. // Call this function itself recursively. decode_xml_attribute(p0, p1, p2, p3, p4, p5, p6); } if ((*hc != *NUMBER_0_INTEGER_MEMORY_MODEL) || (*ie != *NUMBER_0_INTEGER_MEMORY_MODEL)) { // A tag end character as indicator of subsequent element content or // an empty tag end character was detected. break; } } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode xml attribute. The destination details is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode xml attribute. The has content flag is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode xml attribute. The is empty flag is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode xml attribute. The current position is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode xml attribute. The remaining count is null."); } }
/** * Decodes the http uri authority content. * * @param p0 the destination compound (Hand over as reference!) * @param p1 the destination compound count * @param p2 the destination compound size * @param p3 the source uri * @param p4 the source uri count */ void decode_http_uri_authority_content(void* p0, void* p1, void* p2, void* p3, void* p4) { if (p0 != *NULL_POINTER_MEMORY_MODEL) { void** dd = (void**) p0; log_terminated_message((void*) DEBUG_LEVEL_LOG_MODEL, (void*) L"Decode http uri authority content."); // // CAUTION! The uri is added twice to the destination details: // // 1 as full text representation // 2 as compound hierarchy consisting of parts // // Add authority as full text string. append_part(p0, p1, p2, (void*) CYBOI_AUTHORITY_TEXT_URI_NAME, (void*) CYBOI_AUTHORITY_TEXT_URI_NAME_COUNT, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT, p3, p4, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL); // The authority name, abstraction, model, details. void* n = *NULL_POINTER_MEMORY_MODEL; void* nc = *NULL_POINTER_MEMORY_MODEL; void* ns = *NULL_POINTER_MEMORY_MODEL; void* a = *NULL_POINTER_MEMORY_MODEL; void* ac = *NULL_POINTER_MEMORY_MODEL; void* as = *NULL_POINTER_MEMORY_MODEL; void* m = *NULL_POINTER_MEMORY_MODEL; void* mc = *NULL_POINTER_MEMORY_MODEL; void* ms = *NULL_POINTER_MEMORY_MODEL; void* d = *NULL_POINTER_MEMORY_MODEL; void* dc = *NULL_POINTER_MEMORY_MODEL; void* ds = *NULL_POINTER_MEMORY_MODEL; // Allocate authority. allocate_part((void*) &n, (void*) &nc, (void*) &ns, (void*) &a, (void*) &ac, (void*) &as, (void*) &m, (void*) &mc, (void*) &ms, (void*) &d, (void*) &dc, (void*) &ds, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) COMPOUND_MEMORY_ABSTRACTION, (void*) COMPOUND_MEMORY_ABSTRACTION_COUNT); // Decode authority name. decode((void*) &n, (void*) nc, (void*) ns, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, (void*) CYBOI_AUTHORITY_URI_NAME, (void*) CYBOI_AUTHORITY_URI_NAME_COUNT, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, (void*) PLAIN_TEXT_CYBOL_ABSTRACTION, (void*) PLAIN_TEXT_CYBOL_ABSTRACTION_COUNT); // Decode authority abstraction. decode((void*) &a, (void*) ac, (void*) as, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, (void*) COMPOUND_MEMORY_ABSTRACTION, (void*) COMPOUND_MEMORY_ABSTRACTION_COUNT, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, (void*) PLAIN_TEXT_CYBOL_ABSTRACTION, (void*) PLAIN_TEXT_CYBOL_ABSTRACTION_COUNT); // Decode authority model and details. decode((void*) &m, (void*) mc, (void*) ms, (void*) &d, (void*) dc, (void*) ds, p3, p4, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, (void*) AUTHORITY_TEXT_CYBOL_ABSTRACTION, (void*) AUTHORITY_TEXT_CYBOL_ABSTRACTION_COUNT); // Add authority as compound hierarchy consisting of parts. // CAUTION! Hand over the name as reference! append_compound_element_by_name(*dd, p1, p2, (void*) &n, nc, ns, a, ac, as, m, mc, ms, d, dc, ds); } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not decode http uri authority content. The destination details is null."); } }