int main() { /* global value, in "house_network.h" */ log_flag = OFF; status = OFFLINE; pthread_t tid; /* user_id, passwd, interface_name: global var, defines in "public.h", char [32] */ get_from_file(PASSWDFILE, user_id, passwd, interface_name); init_dial_env(); signal(SIGINT, sig_action); // thread_msg_receiver contains "logon()" and "logoff()" operation int ret; ret = pthread_create(&tid, NULL, thread_msg_receiver, NULL); if( 0 != ret) { perror("Create thread failed"); return ret; } // recv eap pkt which comes from cisco server recv_eap_pkt(sock, &sa_ll, ð_header); pthread_join(tid, NULL); close(sock); return 0; }
StatusLine FileReader::read_file(const std::string& full_path,Entity& saver ) { if(get_from_cache(full_path,saver)) { return StatusLine(http_200,""); } boost::uintmax_t file_bytes=boost::filesystem::file_size(full_path) ; if(file_bytes > m_max_file_size) { return StatusLine(http_403,"file too large"); } std::string ext=boost::filesystem::path(full_path).extension().generic_string(); if(!g_supported_file_types.exists(ext)) { return StatusLine(http_415,"not support this file type "+ext); } saver.head().get_container()[HeadFields::EntityFields::ent_content_type]=g_supported_file_types.get_type_name(ext); return get_from_file(full_path,saver); }