xref: /trafficserver/plugins/lua/ts_lua_fetch.h (revision bea9d089)
1 /*
2   Licensed to the Apache Software Foundation (ASF) under one
3   or more contributor license agreements.  See the NOTICE file
4   distributed with this work for additional information
5   regarding copyright ownership.  The ASF licenses this file
6   to you under the Apache License, Version 2.0 (the
7   "License"); you may not use this file except in compliance
8   with the License.  You may obtain a copy of the License at
9 
10   http://www.apache.org/licenses/LICENSE-2.0
11 
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17 */
18 
19 #pragma once
20 
21 #include "ts_lua_common.h"
22 
23 struct fetch_multi_info;
24 
25 typedef struct {
26   TSCont contp;
27   struct fetch_multi_info *fmi;
28 
29   TSIOBuffer buffer;
30   TSIOBufferReader reader;
31   TSFetchSM fch;
32 
33   unsigned int over : 1;
34   unsigned int failed : 1;
35 } ts_lua_fetch_info;
36 
37 typedef struct fetch_multi_info {
38   TSCont contp; // should be destroyed only in cleanup
39   int multi;    // invoke from ts.fetch_multi
40   int total;
41   int done;
42   ts_lua_fetch_info fiv[0];
43 } ts_lua_fetch_multi_info;
44 
45 void ts_lua_inject_fetch_api(lua_State *L);
46