http_static: refactor to use http transport
[vpp.git] / src / plugins / http_static / http_static.h
index 8ee0f92..bc0d937 100644 (file)
@@ -64,20 +64,12 @@ typedef enum
   HTTP_STATE_N_STATES,
 } http_session_state_t;
 
-typedef enum
-{
-  CALLED_FROM_RX,
-  CALLED_FROM_TX,
-  CALLED_FROM_TIMER,
-} http_state_machine_called_from_t;
-
 typedef enum
 {
   HTTP_BUILTIN_METHOD_GET = 0,
   HTTP_BUILTIN_METHOD_POST,
 } http_builtin_method_type_t;
 
-
 /** \brief Application session
  */
 typedef struct
@@ -107,8 +99,6 @@ typedef struct
 
   /** File cache pool index */
   u32 cache_pool_index;
-  /** state machine called from... */
-  http_state_machine_called_from_t called_from;
 } http_session_t;
 
 /** \brief In-memory file data cache entry
@@ -136,16 +126,11 @@ typedef struct
   /** Per thread vector of session pools */
   http_session_t **sessions;
   /** Session pool reader writer lock */
-  clib_rwlock_t sessions_lock;
-  /** vpp session to http session index map */
-  u32 **session_to_http_session;
+  clib_spinlock_t cache_lock;
 
   /** Enable debug messages */
   int debug_level;
 
-  /** vpp message/event queue */
-  svm_msg_q_t **vpp_queue;
-
   /** Unified file data cache pool */
   file_data_cache_t *cache_pool;
   /** Hash table which maps file name to file data */
@@ -169,27 +154,17 @@ typedef struct
   /** root path to be served */
   u8 *www_root;
 
-  /** Server's event queue */
-  svm_queue_t *vl_input_queue;
-
-  /** API client handle */
-  u32 my_client_index;
-
   /** Application index */
   u32 app_index;
 
-  /** Process node index for event scheduling */
-  u32 node_index;
-
   /** Cert and key pair for tls */
   u32 ckpair_index;
 
-  /** Session cleanup timer wheel */
-  tw_timer_wheel_2t_1w_2048sl_t tw;
-  clib_spinlock_t tw_lock;
+  vlib_main_t *vlib_main;
 
-  /** Time base, so we can generate browser cache control http spew */
-  clib_timebase_t timebase;
+  /*
+   * Config
+   */
 
   /** Number of preallocated fifos, usually 0 */
   u32 prealloc_fifos;
@@ -199,15 +174,14 @@ typedef struct
   u32 fifo_size;
   /** The bind URI, defaults to tcp://0.0.0.0/80 */
   u8 *uri;
-  vlib_main_t *vlib_main;
-} http_static_server_main_t;
+  /** Threshold for switching to ptr data in http msgs */
+  u32 use_ptr_thresh;
+} hss_main_t;
 
-extern http_static_server_main_t http_static_server_main;
+extern hss_main_t hss_main;
 
-int http_static_server_enable_api (u32 fifo_size, u32 cache_limit,
-                                  u32 prealloc_fifos,
-                                  u32 private_segment_size,
-                                  u8 * www_root, u8 * uri);
+int hss_enable_api (u32 fifo_size, u32 cache_limit, u32 prealloc_fifos,
+                   u32 private_segment_size, u8 *www_root, u8 *uri);
 
 void http_static_server_register_builtin_handler
   (void *fp, char *url, int type);