github.phpd.cn/cilium/cilium@v1.6.12/proxylib/libcilium.h (about) 1 /* Code generated by cmd/cgo; DO NOT EDIT. */ 2 3 /* package github.com/cilium/cilium/proxylib */ 4 5 6 #line 1 "cgo-builtin-prolog" 7 8 #include <stddef.h> /* for ptrdiff_t below */ 9 10 #ifndef GO_CGO_EXPORT_PROLOGUE_H 11 #define GO_CGO_EXPORT_PROLOGUE_H 12 13 typedef struct { const char *p; ptrdiff_t n; } _GoString_; 14 15 #endif 16 17 /* Start of preamble from import "C" comments. */ 18 19 20 #line 17 "proxylib.go" 21 22 #include "proxylib/types.h" 23 24 #line 1 "cgo-generated-wrapper" 25 26 27 /* End of preamble from import "C" comments. */ 28 29 30 /* Start of boilerplate cgo prologue. */ 31 #line 1 "cgo-gcc-export-header-prolog" 32 33 #ifndef GO_CGO_PROLOGUE_H 34 #define GO_CGO_PROLOGUE_H 35 36 typedef signed char GoInt8; 37 typedef unsigned char GoUint8; 38 typedef short GoInt16; 39 typedef unsigned short GoUint16; 40 typedef int GoInt32; 41 typedef unsigned int GoUint32; 42 typedef long long GoInt64; 43 typedef unsigned long long GoUint64; 44 typedef GoInt64 GoInt; 45 typedef GoUint64 GoUint; 46 typedef __SIZE_TYPE__ GoUintptr; 47 typedef float GoFloat32; 48 typedef double GoFloat64; 49 typedef float _Complex GoComplex64; 50 typedef double _Complex GoComplex128; 51 52 /* 53 static assertion to make sure the file is being used on architecture 54 at least with matching size of GoInt. 55 */ 56 typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; 57 58 typedef _GoString_ GoString; 59 typedef void *GoMap; 60 typedef void *GoChan; 61 typedef struct { void *t; void *v; } GoInterface; 62 typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; 63 64 #endif 65 66 /* End of boilerplate cgo prologue. */ 67 68 #ifdef __cplusplus 69 extern "C" { 70 #endif 71 72 73 // OnNewConnection is used to register a new connection of protocol 'proto'. 74 // Note that the 'origBuf' and replyBuf' type '*[]byte' corresponds to 'InjectBuf' type, but due to 75 // cgo export restrictions we can't use the go type in the prototype. 76 77 extern FilterResult OnNewConnection(GoUint64 p0, GoString p1, GoUint64 p2, GoUint8 p3, GoUint32 p4, GoUint32 p5, GoString p6, GoString p7, GoString p8, GoSlice* p9, GoSlice* p10); 78 79 // Each connection is assumed to be called from a single thread, so accessing connection metadata 80 // does not need protection. 81 // 82 // OnData gets all the unparsed data the datapath has received so far. The data is provided to the parser 83 // associated with the connection, and the parser is expected to find if the data frame contains enough data 84 // to make a PASS/DROP decision for the whole data frame. Note that the whole data frame need not be received, 85 // if the decision including the length of the data frame in bytes can be determined based on the beginning of 86 // the data frame only (e.g., headers including the length of the data frame). The parser returns a decision 87 // with the number of bytes on which the decision applies. If more data is available, then the parser will be 88 // called again with the remaining data. Parser needs to return MORE if a decision can't be made with 89 // the available data, including the minimum number of additional bytes that is needed before the parser is 90 // called again. 91 // 92 // The parser can also inject at arbitrary points in the data stream. This is indecated by an INJECT operation 93 // with the number of bytes to be injected. The actual bytes to be injected are provided via an Inject() 94 // callback prior to returning the INJECT operation. The Inject() callback operates on a limited size buffer 95 // provided by the datapath, and multiple INJECT operations may be needed to inject large amounts of data. 96 // Since we get the data on one direction at a time, any frames to be injected in the reverse direction 97 // are placed in the reverse direction buffer, from where the datapath injects the data before calling 98 // us again for the reverse direction input. 99 // 100 101 extern FilterResult OnData(GoUint64 p0, GoUint8 p1, GoUint8 p2, GoSlice* p3, GoSlice* p4); 102 103 // Make this more general connection event callback 104 105 extern void Close(GoUint64 p0); 106 107 // OpenModule is called before any other APIs. 108 // Called concurrently by different filter instances. 109 // Returns a library instance ID that must be passed to all other API calls. 110 // Calls with the same parameters will return the same instance. 111 // Zero return value indicates an error. 112 113 extern GoUint64 OpenModule(GoSlice p0, GoUint8 p1); 114 115 extern void CloseModule(GoUint64 p0); 116 117 #ifdef __cplusplus 118 } 119 #endif