diff --git a/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go b/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go index 49dcf8b2..f7090df8 100644 --- a/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go +++ b/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go @@ -1,3 +1,17 @@ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mod_wasmplug import ( diff --git a/bfe_modules/mod_wasmplug/mod_wasmplug.go b/bfe_modules/mod_wasmplug/mod_wasmplug.go index 9e2aea16..72c59c7a 100644 --- a/bfe_modules/mod_wasmplug/mod_wasmplug.go +++ b/bfe_modules/mod_wasmplug/mod_wasmplug.go @@ -1,3 +1,17 @@ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mod_wasmplug import ( diff --git a/bfe_wasmplug/abi/proxywasm010/factory.go b/bfe_wasmplug/abi/proxywasm010/factory.go index 3299d070..349fc952 100644 --- a/bfe_wasmplug/abi/proxywasm010/factory.go +++ b/bfe_wasmplug/abi/proxywasm010/factory.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package proxywasm010 diff --git a/bfe_wasmplug/abi/proxywasm010/imports.go b/bfe_wasmplug/abi/proxywasm010/imports.go index 77264e23..3d73b5f9 100644 --- a/bfe_wasmplug/abi/proxywasm010/imports.go +++ b/bfe_wasmplug/abi/proxywasm010/imports.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package proxywasm010 diff --git a/bfe_wasmplug/abi/proxywasm010/shim.go b/bfe_wasmplug/abi/proxywasm010/shim.go index 161480c9..b771a5a5 100644 --- a/bfe_wasmplug/abi/proxywasm010/shim.go +++ b/bfe_wasmplug/abi/proxywasm010/shim.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package proxywasm010 diff --git a/bfe_wasmplug/abi/registry.go b/bfe_wasmplug/abi/registry.go index 021f73ae..0b553aaf 100644 --- a/bfe_wasmplug/abi/registry.go +++ b/bfe_wasmplug/abi/registry.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package abi diff --git a/bfe_wasmplug/adapter.go b/bfe_wasmplug/adapter.go index aa7eb4b2..c9335251 100644 --- a/bfe_wasmplug/adapter.go +++ b/bfe_wasmplug/adapter.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package bfe_wasmplug diff --git a/bfe_wasmplug/engine.go b/bfe_wasmplug/engine.go index 26dc81b4..a9bf5ae9 100644 --- a/bfe_wasmplug/engine.go +++ b/bfe_wasmplug/engine.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package bfe_wasmplug diff --git a/bfe_wasmplug/filter.go b/bfe_wasmplug/filter.go index 3165603a..3a417fe5 100644 --- a/bfe_wasmplug/filter.go +++ b/bfe_wasmplug/filter.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package bfe_wasmplug diff --git a/bfe_wasmplug/plugin.go b/bfe_wasmplug/plugin.go index f0460a50..2e53d709 100644 --- a/bfe_wasmplug/plugin.go +++ b/bfe_wasmplug/plugin.go @@ -1,19 +1,16 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (c) 2019 The BFE Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package bfe_wasmplug @@ -301,49 +298,49 @@ func (w *wasmPluginImpl) ReleaseInstance(instance common.WasmInstance) { } func (w *wasmPluginImpl) OnInstanceStart(instance common.WasmInstance) bool { - abi := wasmABI.GetABIList(instance)[0] - var exports v1Host.Exports - if abi != nil { - // v1 - imports := &v1Imports{plugin: w} - imports.DefaultImportsHandler.Instance = instance - abi.SetImports(imports) - exports = abi.GetExports() - } else { - log.Logger.Error("[proxywasm][factory] unknown abi list: %v", abi) - return false - } - - instance.Lock(abi) - defer instance.Unlock() + abi := wasmABI.GetABIList(instance)[0] + var exports v1Host.Exports + if abi != nil { + // v1 + imports := &v1Imports{plugin: w} + imports.DefaultImportsHandler.Instance = instance + abi.SetImports(imports) + exports = abi.GetExports() + } else { + log.Logger.Error("[proxywasm][factory] unknown abi list: %v", abi) + return false + } - err := exports.ProxyOnContextCreate(w.rootContextID, 0) - if err != nil { - log.Logger.Error("[proxywasm][factory] OnPluginStart fail to create root context id, err: %v", err) - return true - } + instance.Lock(abi) + defer instance.Unlock() - vmConfigSize := 0 - // no vm config + err := exports.ProxyOnContextCreate(w.rootContextID, 0) + if err != nil { + log.Logger.Error("[proxywasm][factory] OnPluginStart fail to create root context id, err: %v", err) + return true + } - _, err = exports.ProxyOnVmStart(w.rootContextID, int32(vmConfigSize)) - if err != nil { - log.Logger.Error("[proxywasm][factory] OnPluginStart fail to create root context id, err: %v", err) - return true - } + vmConfigSize := 0 + // no vm config - pluginConfigSize := 0 - if pluginConfigBytes := w.GetPluginConfig(); pluginConfigBytes != nil { - pluginConfigSize = len(pluginConfigBytes) - } + _, err = exports.ProxyOnVmStart(w.rootContextID, int32(vmConfigSize)) + if err != nil { + log.Logger.Error("[proxywasm][factory] OnPluginStart fail to create root context id, err: %v", err) + return true + } - _, err = exports.ProxyOnConfigure(w.rootContextID, int32(pluginConfigSize)) - if err != nil { - log.Logger.Error("[proxywasm][factory] OnPluginStart fail to create root context id, err: %v", err) - return true - } + pluginConfigSize := 0 + if pluginConfigBytes := w.GetPluginConfig(); pluginConfigBytes != nil { + pluginConfigSize = len(pluginConfigBytes) + } + _, err = exports.ProxyOnConfigure(w.rootContextID, int32(pluginConfigSize)) + if err != nil { + log.Logger.Error("[proxywasm][factory] OnPluginStart fail to create root context id, err: %v", err) return true + } + + return true } func (w *wasmPluginImpl) OnPluginStart() {