crate::ix!();
pub const DEFAULT_HTTP_THREADS: i32 = 4;
pub const DEFAULT_HTTP_WORKQUEUE: i32 = 16;
pub const DEFAULT_HTTP_SERVER_TIMEOUT: i32 = 30;
pub type HTTPRequestHandler = fn(req: *mut HTTPRequest, _1: &String) -> bool;
pub struct HTTPRequest {
req: *mut libevent_sys::evhttp_request,
reply_sent: bool,
}
pub mod http_request {
pub enum RequestMethod {
UNKNOWN,
GET,
POST,
HEAD,
PUT
}
}
pub trait HTTPClosure {
fn invoke(&mut self);
}
pub struct HTTPEvent {
delete_when_triggered: bool,
handler: fn() -> (),
ev: *mut libevent_sys::event,
}
impl HTTPEvent {
pub fn new(
base: *mut libevent_sys::event_base,
delete_when_triggered: bool,
handler: &fn() -> ()) -> Self {
todo!();
}
pub fn trigger(&mut self, tv: *mut libc::timeval) {
todo!();
}
}
pub const MAX_HEADERS_SIZE: usize = 8192;
pub struct HTTPWorkItem {
req: Box<HTTPRequest>,
path: String,
func: HTTPRequestHandler,
}
impl HTTPClosure for HTTPWorkItem {
fn invoke(&mut self) {
todo!();
}
}
impl HTTPWorkItem {
pub fn new(
req: Box<HTTPRequest>,
path: &String,
func: &HTTPRequestHandler) -> Self {
todo!();
}
}
pub struct WorkQueue<WorkItem> {
cs: Mutex<WorkQueueInner<WorkItem>>,
max_depth: usize,
}
pub struct WorkQueueInner<WorkItem> {
cond: std::sync::Condvar,
queue: VecDeque<Box<WorkItem>>,
running: bool,
}
impl<WorkItem> Drop for WorkQueue<WorkItem> {
fn drop(&mut self) {
todo!();
}
}
impl<WorkItem> WorkQueue<WorkItem> {
pub fn new(max_depth: usize) -> Self {
todo!();
}
pub fn enqueue(&mut self, item: *mut WorkItem) -> bool {
todo!();
}
pub fn run(&mut self) {
todo!();
}
pub fn interrupt(&mut self) {
todo!();
}
}
pub struct HTTPPathHandler {
prefix: String,
exact_match: bool,
handler: HTTPRequestHandler,
}
impl HTTPPathHandler {
pub fn new(
prefix: String,
exact_match: bool,
handler: HTTPRequestHandler) -> Self {
todo!();
}
}
lazy_static!{
}
lazy_static!{
}
lazy_static!{
}
lazy_static!{
}
lazy_static!{
}
lazy_static!{
}
pub fn client_allowed(netaddr: &NetAddr) -> bool {
todo!();
}
pub fn init_http_allow_list() -> bool {
todo!();
}
pub fn request_method_string(m: http_request::RequestMethod) -> String {
todo!();
}
pub fn http_request_cb(
req: *mut libevent_sys::evhttp_request,
arg: *mut c_void) {
todo!();
}
pub fn http_reject_request_cb(
req: *mut libevent_sys::evhttp_request,
_1: *mut c_void) {
todo!();
}
pub fn threadhttp(base: *mut libevent_sys::event_base) -> bool {
todo!();
}
pub fn http_bind_addresses(http: *mut libevent_sys::evhttp) -> bool {
todo!();
}
pub fn http_work_queue_run(
queue: *mut WorkQueue<Box<dyn HTTPClosure>>,
worker_num: i32) {
todo!();
}
pub fn libevent_log_cb(
severity: i32,
msg: *const u8) {
todo!();
}
pub fn init_http_server() -> bool {
todo!();
}
pub fn update_http_server_logging(enable: bool) -> bool {
todo!();
}
lazy_static!{
}
pub fn start_http_server() {
todo!();
}
pub fn interrupt_http_server() {
todo!();
}
pub fn stop_http_server() {
todo!();
}
pub fn event_base() -> *mut libevent_sys::event_base {
todo!();
}
pub fn httpevent_callback_fn(
_0: libevent::EvutilSocket,
_1: i16,
data: *mut c_void) {
todo!();
}
impl Drop for HTTPEvent {
fn drop(&mut self) {
todo!();
}
}
impl Drop for HTTPRequest {
fn drop(&mut self) {
todo!();
}
}
impl HTTPRequest {
pub fn new(
req: *mut libevent_sys::evhttp_request,
reply_sent: Option<bool>) -> Self {
let reply_sent: bool = reply_sent.unwrap_or(false);
todo!();
}
pub fn get_header(&self, hdr: &String) -> (bool,String) {
todo!();
}
pub fn read_body(&mut self) -> String {
todo!();
}
pub fn write_header(&mut self,
hdr: &String,
value: &String) {
todo!();
}
pub fn write_reply(&mut self,
n_status: i32,
str_reply: Option<&str>) {
let str_reply: &str = str_reply.unwrap_or("");
todo!();
}
pub fn get_peer(&self) -> Service {
todo!();
}
pub fn geturi(&self) -> String {
todo!();
}
pub fn get_request_method(&self) -> http_request::RequestMethod {
todo!();
}
}
pub fn register_http_handler(
prefix: &String,
exact_match: bool,
handler: &HTTPRequestHandler) {
todo!();
}
pub fn unregister_http_handler(
prefix: &String,
exact_match: bool) {
todo!();
}