bool airport::Uriparser::_parse(const char*src, size_t src_len) { const char * scheme; size_t scheme_len; const char * host; size_t host_len; const char *path_query; int path_query_len; const char *fragment; int fragment_len; int ret = nu_parse_uri(src, src_len, &scheme, &scheme_len, &host, &host_len, &port_, &path_query, &path_query_len, &fragment, &fragment_len); if (ret != 0) { path_query_.assign(src, src_len); path_query_ = canonical_path(path_query_); return false; // parse error } uri_.assign(src, src_len); host_.assign(host, host_len); path_query_.assign(path_query, path_query_len); scheme_.assign(scheme, scheme_len); fragment_.assign(fragment, fragment_len); path_query_ = canonical_path(path_query_); return true; }
// event from back end (draw event from remote or internal server) // returns module continuation status, 0 if module want to continue // non 0 if it wants to stop (to run another module) virtual BackEvent_t draw_event() { this->event.reset(); TODO("use system constants for sizes"); char path[1024]; char basename[1024]; char extension[128]; strcpy(path, "/tmp/"); // default value, actual one should come from movie_path strcpy(basename, "replay"); // default value actual one should come from movie_path strcpy(extension, ".mwrm"); // extension is currently ignored char prefix[4096]; canonical_path(this->movie, path, sizeof(path), basename, sizeof(basename), extension, sizeof(extension)); sprintf(prefix, "%s%s", path, basename); InByMetaSequenceTransport in_trans(prefix, extension); timeval begin_capture; begin_capture.tv_sec = 0; begin_capture.tv_usec = 0; timeval end_capture; end_capture.tv_sec = 0; end_capture.tv_usec = 0; FileToGraphic reader(&in_trans, begin_capture, end_capture, true, 0); reader.add_consumer(&this->front); this->front.send_global_palette(); this->front.begin_update(); while (reader.next_order()){ reader.interpret_order(); } this->front.end_update(); return BACK_EVENT_NONE; }
gfx_animated_object::gfx_animated_object(qtgl::batch const batch_) : m_batch(batch_) , m_animation_names() , m_animation_index(0U) , m_animation_time(0.0f) , m_keyframes() { TMPROF_BLOCK(); ASSUMPTION(get_batch().ready()); ASSUMPTION(get_batch().get_available_resources().skeletal() != nullptr); boost::filesystem::path anim_root_dir = canonical_path(get_batch().get_available_resources().data_root_dir()) / "animations" / "skeletal" / get_batch().get_available_resources().skeletal()->skeleton_name() ; for (boost::filesystem::directory_entry& entry : boost::filesystem::directory_iterator(anim_root_dir)) if (boost::filesystem::is_directory(entry.path())) m_animation_names.push_back(entry.path().string()); if (m_animation_names.empty()) return; m_keyframes.insert_load_request(m_animation_names.at(m_animation_index)); ASSUMPTION(!m_keyframes.empty()); }
Read buf_next_line() { if (Read::Eof == this->mwrm_reader.read_meta_line(this->meta_line)) { return Read::Eof; } if (!file_exist(this->meta_line.filename)) { char original_path[1024] = {}; char basename[1024] = {}; char extension[256] = {}; char filename[2048] = {}; canonical_path( this->meta_line.filename , original_path, sizeof(original_path) , basename, sizeof(basename) , extension, sizeof(extension)); std::snprintf(filename, sizeof(filename), "%s%s%s", this->meta_path, basename, extension); if (file_exist(filename)) { strcpy(this->meta_line.filename, filename); } } return Read::Ok; }
InMetaSequenceTransport( CryptoContext & cctx, const char * filename, const char * extension, EncryptionMode encryption, Fstat & fstat) : cfb(cctx, encryption, fstat) , begin_time(0) , buf_meta(cctx, encryption, fstat) , mwrm_reader(this->buf_meta) { char meta_filename[1024]; // concat { int res = std::snprintf(meta_filename, sizeof(meta_filename), "%s%s", filename, extension); if (res >= int(sizeof(meta_filename))) { throw Error(ERR_TRANSPORT); } } this->buf_meta.open(meta_filename); this->mwrm_reader.read_meta_headers(); this->meta_line.start_time = 0; this->meta_line.stop_time = 0; this->meta_path[0] = 0; char basename[1024] = {}; char extension2[256] = {}; canonical_path( meta_filename , this->meta_path, sizeof(this->meta_path) , basename, sizeof(basename) , extension2, sizeof(extension2)); }
ReplayMod( FrontAPI & front , const char * replay_path , const char * movie , uint16_t width , uint16_t height , std::string & auth_error_message , Font const & font , bool wait_for_escape , uint32_t debug_capture) : InternalMod(front, width, height, font) , auth_error_message(auth_error_message) , end_of_data(false) , wait_for_escape(wait_for_escape) { char path_movie[1024]; snprintf(path_movie, sizeof(path_movie)-1, "%s%s", replay_path, movie); path_movie[sizeof(path_movie)-1] = 0; LOG(LOG_INFO, "Playing %s", path_movie); char path[1024]; char basename[1024]; char extension[128]; strcpy(path, RECORD_PATH); // default value, actual one should come from movie_path strcpy(basename, "replay"); // default value actual one should come from movie_path strcpy(extension, ".mwrm"); // extension is currently ignored char prefix[4096]; const bool res = canonical_path( path_movie , path, sizeof(path) , basename, sizeof(basename) , extension, sizeof(extension) ); if (!res) { LOG(LOG_ERR, "Buffer Overflowed: Path too long"); throw Error(ERR_RECORDER_FAILED_TO_FOUND_PATH); } snprintf(prefix, sizeof(prefix), "%s%s", path, basename); this->reader.construct(prefix, extension, debug_capture); switch (this->front.server_resize( this->reader->info_width , this->reader->info_height , this->reader->info_bpp)) { case 0: // no resizing needed break; case 1: // resizing done this->front_width = this->reader->info_width; this->front_height = this->reader->info_height; this->screen.rect.cx = this->reader->info_width; this->screen.rect.cy = this->reader->info_height; break; case -1: // resizing failed // thow an Error ? LOG(LOG_WARNING, "Older RDP client can't resize to server asked resolution, disconnecting"); throw Error(ERR_VNC_OLDER_RDP_CLIENT_CANT_RESIZE); } this->reader->add_consumer(&this->front, nullptr, nullptr, nullptr, nullptr); }
ReplayMod( FrontAPI & front , const char * replay_path , const char * movie , uint16_t width , uint16_t height , std::string & auth_error_message , Inifile & ini) : InternalMod(front, width, height, ini.font) , auth_error_message(auth_error_message) , end_of_data(false) , ini(ini) { strncpy(this->movie, replay_path, sizeof(this->movie)-1); strncat(this->movie, movie, sizeof(this->movie)-1); LOG(LOG_INFO, "Playing %s", this->movie); char path[1024]; char basename[1024]; char extension[128]; strcpy(path, RECORD_PATH); // default value, actual one should come from movie_path strcpy(basename, "replay"); // default value actual one should come from movie_path strcpy(extension, ".mwrm"); // extension is currently ignored char prefix[4096]; const bool res = canonical_path( this->movie , path, sizeof(path) , basename, sizeof(basename) , extension, sizeof(extension) ); if (!res) { LOG(LOG_ERR, "Buffer Overflowed: Path too long"); throw Error(ERR_RECORDER_FAILED_TO_FOUND_PATH); } snprintf(prefix, sizeof(prefix), "%s%s", path, basename); this->in_trans = new InMetaSequenceTransport(prefix, extension); timeval begin_capture; begin_capture.tv_sec = 0; begin_capture.tv_usec = 0; timeval end_capture; end_capture.tv_sec = 0; end_capture.tv_usec = 0; this->reader = new FileToGraphic( this->in_trans, begin_capture, end_capture, true , this->ini.debug.capture); switch (this->front.server_resize( this->reader->info_width , this->reader->info_height , this->reader->info_bpp)) { case 0: // no resizing needed break; case 1: // resizing done this->front_width = this->reader->info_width; this->front_height = this->reader->info_height; this->screen.rect.cx = this->reader->info_width; this->screen.rect.cy = this->reader->info_height; break; case -1: // resizing failed // thow an Error ? LOG(LOG_WARNING, "Older RDP client can't resize to server asked resolution, disconnecting"); throw Error(ERR_VNC_OLDER_RDP_CLIENT_CANT_RESIZE); } this->reader->add_consumer(&this->front, nullptr); this->front.send_global_palette(); }