You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2017/01/10 15:58:50 UTC
[29/55] [partial] qpid-proton-j git commit: PROTON-1385: retain
proton-j content only, the rest remains in the other repo at:
https://git-wip-us.apache.org/repos/asf/qpid-proton.git
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go b/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go
deleted file mode 100644
index 961136e..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
-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.
-*/
-
-package proton
-
-import "fmt"
-
-// EventHandler handles core proton events.
-type EventHandler interface {
- // HandleEvent is called with an event.
- // Typically HandleEvent() is implemented as a switch on e.Type()
- // Returning an error will stop the Engine.
- HandleEvent(e Event)
-}
-
-// MessagingHandler provides an alternative interface to EventHandler.
-// it is easier to use for most applications that send and receive messages.
-//
-// Implement this interface and then wrap your value with a MessagingHandlerDelegator.
-// MessagingHandlerDelegator implements EventHandler and can be registered with a Engine.
-//
-type MessagingHandler interface {
- // HandleMessagingEvent is called with MessagingEvent.
- // Typically HandleEvent() is implemented as a switch on e.Type()
- // Returning an error will stop the Engine.
- HandleMessagingEvent(MessagingEvent, Event)
-}
-
-// MessagingEvent provides a set of events that are easier to work with than the
-// core events defined by EventType
-//
-// There are 3 types of "endpoint": Connection, Session and Link. For each
-// endpoint there are 5 events: Opening, Opened, Closing, Closed and Error.
-//
-// The meaning of these events is as follows:
-//
-// Opening: The remote end opened, the local end will open automatically.
-//
-// Opened: Both ends are open, regardless of which end opened first.
-//
-// Closing: The remote end closed without error, the local end will close automatically.
-//
-// Error: The remote end closed with an error, the local end will close automatically.
-//
-// Closed: Both ends are closed, regardless of which end closed first or if there was an error.
-// No further events will be received for the endpoint.
-//
-type MessagingEvent int
-
-const (
- // The event loop starts.
- MStart MessagingEvent = iota
- // The peer closes the connection with an error condition.
- MConnectionError
- // The peer closes the session with an error condition.
- MSessionError
- // The peer closes the link with an error condition.
- MLinkError
- // The peer Initiates the opening of the connection.
- MConnectionOpening
- // The peer initiates the opening of the session.
- MSessionOpening
- // The peer initiates the opening of the link.
- MLinkOpening
- // The connection is opened.
- MConnectionOpened
- // The session is opened.
- MSessionOpened
- // The link is opened.
- MLinkOpened
- // The peer initiates the closing of the connection.
- MConnectionClosing
- // The peer initiates the closing of the session.
- MSessionClosing
- // The peer initiates the closing of the link.
- MLinkClosing
- // Both ends of the connection are closed.
- MConnectionClosed
- // Both ends of the session are closed.
- MSessionClosed
- // Both ends of the link are closed.
- MLinkClosed
- // The sender link has credit and messages can
- // therefore be transferred.
- MSendable
- // The remote peer accepts an outgoing message.
- MAccepted
- // The remote peer rejects an outgoing message.
- MRejected
- // The peer releases an outgoing message. Note that this may be in response to
- // either the RELEASE or MODIFIED state as defined by the AMQP specification.
- MReleased
- // The peer has settled the outgoing message. This is the point at which it
- // should never be re-transmitted.
- MSettled
- // A message is received. Call Event.Delivery().Message() to decode as an amqp.Message.
- // To manage the outcome of this messages (e.g. to accept or reject the message)
- // use Event.Delivery().
- MMessage
- // A network connection was disconnected.
- MDisconnected
-)
-
-func (t MessagingEvent) String() string {
- switch t {
- case MStart:
- return "Start"
- case MConnectionError:
- return "ConnectionError"
- case MSessionError:
- return "SessionError"
- case MLinkError:
- return "LinkError"
- case MConnectionOpening:
- return "ConnectionOpening"
- case MSessionOpening:
- return "SessionOpening"
- case MLinkOpening:
- return "LinkOpening"
- case MConnectionOpened:
- return "ConnectionOpened"
- case MSessionOpened:
- return "SessionOpened"
- case MLinkOpened:
- return "LinkOpened"
- case MConnectionClosing:
- return "ConnectionClosing"
- case MSessionClosing:
- return "SessionClosing"
- case MLinkClosing:
- return "LinkClosing"
- case MConnectionClosed:
- return "ConnectionClosed"
- case MSessionClosed:
- return "SessionClosed"
- case MLinkClosed:
- return "LinkClosed"
- case MDisconnected:
- return "Disconnected"
- case MSendable:
- return "Sendable"
- case MAccepted:
- return "Accepted"
- case MRejected:
- return "Rejected"
- case MReleased:
- return "Released"
- case MSettled:
- return "Settled"
- case MMessage:
- return "Message"
- default:
- return "Unknown"
- }
-}
-
-// ResourceHandler provides a simple way to track the creation and deletion of
-// various proton objects.
-// endpointDelegator captures common patterns for endpoints opening/closing
-type endpointDelegator struct {
- remoteOpen, remoteClose, localOpen, localClose EventType
- opening, opened, closing, closed, error MessagingEvent
- endpoint func(Event) Endpoint
- delegator *MessagingAdapter
-}
-
-// HandleEvent handles an open/close event for an endpoint in a generic way.
-func (d endpointDelegator) HandleEvent(e Event) {
- endpoint := d.endpoint(e)
- state := endpoint.State()
-
- switch e.Type() {
-
- case d.localOpen:
- if state.RemoteActive() {
- d.delegator.mhandler.HandleMessagingEvent(d.opened, e)
- }
-
- case d.remoteOpen:
- d.delegator.mhandler.HandleMessagingEvent(d.opening, e)
- switch {
- case state.LocalActive():
- d.delegator.mhandler.HandleMessagingEvent(d.opened, e)
- case state.LocalUninit():
- if d.delegator.AutoOpen {
- endpoint.Open()
- }
- }
-
- case d.remoteClose:
- if endpoint.RemoteCondition().IsSet() { // Closed with error
- d.delegator.mhandler.HandleMessagingEvent(d.error, e)
- } else {
- d.delegator.mhandler.HandleMessagingEvent(d.closing, e)
- }
- if state.LocalClosed() {
- d.delegator.mhandler.HandleMessagingEvent(d.closed, e)
- } else if state.LocalActive() {
- endpoint.Close()
- }
-
- case d.localClose:
- if state.RemoteClosed() {
- d.delegator.mhandler.HandleMessagingEvent(d.closed, e)
- }
-
- default:
- // We shouldn't be called with any other event type.
- panic(fmt.Errorf("internal error, not an open/close event: %s", e))
- }
-}
-
-type flowcontroller struct {
- window, drained int
-}
-
-func (d flowcontroller) HandleEvent(e Event) {
- link := e.Link()
-
- switch e.Type() {
- case ELinkLocalOpen, ELinkRemoteOpen, ELinkFlow, EDelivery:
- if link.IsReceiver() {
- d.drained += link.Drained()
- if d.drained != 0 {
- link.Flow(d.window - link.Credit())
- }
- }
- }
-}
-
-// MessagingAdapter implments a EventHandler and delegates to a MessagingHandler.
-// You can modify the exported fields before you pass the MessagingAdapter to
-// a Engine.
-type MessagingAdapter struct {
- mhandler MessagingHandler
- connection, session, link endpointDelegator
- flowcontroller EventHandler
-
- // AutoSettle (default true) automatically pre-settle outgoing messages.
- AutoSettle bool
- // AutoAccept (default true) automatically accept and settle incoming messages
- // if they are not settled by the delegate.
- AutoAccept bool
- // AutoOpen (default true) automatically open remotely opened endpoints.
- AutoOpen bool
- // Prefetch (default 10) initial credit to issue for incoming links.
- Prefetch int
- // PeerCloseIsError (default false) if true a close by the peer will be treated as an error.
- PeerCloseError bool
-}
-
-func NewMessagingAdapter(h MessagingHandler) *MessagingAdapter {
- return &MessagingAdapter{
- mhandler: h,
- flowcontroller: nil,
- AutoSettle: true,
- AutoAccept: true,
- AutoOpen: true,
- Prefetch: 10,
- PeerCloseError: false,
- }
-}
-
-func handleIf(h EventHandler, e Event) {
- if h != nil {
- h.HandleEvent(e)
- }
-}
-
-// Handle a proton event by passing the corresponding MessagingEvent(s) to
-// the MessagingHandler.
-func (d *MessagingAdapter) HandleEvent(e Event) {
- handleIf(d.flowcontroller, e)
-
- switch e.Type() {
-
- case EConnectionInit:
- d.connection = endpointDelegator{
- EConnectionRemoteOpen, EConnectionRemoteClose, EConnectionLocalOpen, EConnectionLocalClose,
- MConnectionOpening, MConnectionOpened, MConnectionClosing, MConnectionClosed,
- MConnectionError,
- func(e Event) Endpoint { return e.Connection() },
- d,
- }
- d.session = endpointDelegator{
- ESessionRemoteOpen, ESessionRemoteClose, ESessionLocalOpen, ESessionLocalClose,
- MSessionOpening, MSessionOpened, MSessionClosing, MSessionClosed,
- MSessionError,
- func(e Event) Endpoint { return e.Session() },
- d,
- }
- d.link = endpointDelegator{
- ELinkRemoteOpen, ELinkRemoteClose, ELinkLocalOpen, ELinkLocalClose,
- MLinkOpening, MLinkOpened, MLinkClosing, MLinkClosed,
- MLinkError,
- func(e Event) Endpoint { return e.Link() },
- d,
- }
- if d.Prefetch > 0 {
- d.flowcontroller = flowcontroller{window: d.Prefetch, drained: 0}
- }
- d.mhandler.HandleMessagingEvent(MStart, e)
-
- case EConnectionRemoteOpen:
-
- d.connection.HandleEvent(e)
-
- case EConnectionRemoteClose:
- d.connection.HandleEvent(e)
- e.Connection().Transport().CloseTail()
-
- case EConnectionLocalOpen, EConnectionLocalClose:
- d.connection.HandleEvent(e)
-
- case ESessionRemoteOpen, ESessionRemoteClose, ESessionLocalOpen, ESessionLocalClose:
- d.session.HandleEvent(e)
-
- case ELinkRemoteOpen:
- e.Link().Source().Copy(e.Link().RemoteSource())
- e.Link().Target().Copy(e.Link().RemoteTarget())
- d.link.HandleEvent(e)
-
- case ELinkRemoteClose, ELinkLocalOpen, ELinkLocalClose:
- d.link.HandleEvent(e)
-
- case ELinkFlow:
- if e.Link().IsSender() && e.Link().Credit() > 0 {
- d.mhandler.HandleMessagingEvent(MSendable, e)
- }
-
- case EDelivery:
- if e.Delivery().Link().IsReceiver() {
- d.incoming(e)
- } else {
- d.outgoing(e)
- }
-
- case ETransportClosed:
- d.mhandler.HandleMessagingEvent(MDisconnected, e)
- }
-}
-
-func (d *MessagingAdapter) incoming(e Event) {
- delivery := e.Delivery()
- if delivery.HasMessage() {
- d.mhandler.HandleMessagingEvent(MMessage, e)
- if d.AutoAccept && !delivery.Settled() {
- delivery.Accept()
- }
- if delivery.Current() {
- e.Link().Advance()
- }
- } else if delivery.Updated() && delivery.Settled() {
- d.mhandler.HandleMessagingEvent(MSettled, e)
- }
- return
-}
-
-func (d *MessagingAdapter) outgoing(e Event) {
- delivery := e.Delivery()
- if delivery.Updated() {
- switch delivery.Remote().Type() {
- case Accepted:
- d.mhandler.HandleMessagingEvent(MAccepted, e)
- case Rejected:
- d.mhandler.HandleMessagingEvent(MRejected, e)
- case Released, Modified:
- d.mhandler.HandleMessagingEvent(MReleased, e)
- }
- if delivery.Settled() {
- // The delivery was settled remotely, inform the local end.
- d.mhandler.HandleMessagingEvent(MSettled, e)
- }
- if d.AutoSettle {
- delivery.Settle() // Local settle, don't mhandler MSettled till the remote end settles.
- }
- }
- return
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/go/src/qpid.apache.org/proton/message.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/message.go b/proton-c/bindings/go/src/qpid.apache.org/proton/message.go
deleted file mode 100644
index 2336483..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/message.go
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-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.
-*/
-
-package proton
-
-// #include <proton/types.h>
-// #include <proton/message.h>
-// #include <proton/codec.h>
-import "C"
-
-import (
- "fmt"
- "qpid.apache.org/amqp"
- "strconv"
- "sync/atomic"
-)
-
-// HasMessage is true if all message data is available.
-// Equivalent to !d.isNil && d.Readable() && !d.Partial()
-func (d Delivery) HasMessage() bool { return !d.IsNil() && d.Readable() && !d.Partial() }
-
-// Message decodes the message containined in a delivery.
-//
-// Must be called in the correct link context with this delivery as the current message,
-// handling an MMessage event is always a safe context to call this function.
-//
-// Will return an error if message is incomplete or not current.
-func (delivery Delivery) Message() (m amqp.Message, err error) {
- if !delivery.Readable() {
- return nil, fmt.Errorf("delivery is not readable")
- }
- if delivery.Partial() {
- return nil, fmt.Errorf("delivery has partial message")
- }
- data := make([]byte, delivery.Pending())
- result := delivery.Link().Recv(data)
- if result != len(data) {
- return nil, fmt.Errorf("cannot receive message: %s", PnErrorCode(result))
- }
- m = amqp.NewMessage()
- err = m.Decode(data)
- return
-}
-
-// Process-wide atomic counter for generating tag names
-var tagCounter uint64
-
-func nextTag() string {
- return strconv.FormatUint(atomic.AddUint64(&tagCounter, 1), 32)
-}
-
-// Send sends a amqp.Message over a Link.
-// Returns a Delivery that can be use to determine the outcome of the message.
-func (link Link) Send(m amqp.Message) (Delivery, error) {
- if !link.IsSender() {
- return Delivery{}, fmt.Errorf("attempt to send message on receiving link")
- }
-
- delivery := link.Delivery(nextTag())
- bytes, err := m.Encode(nil)
- if err != nil {
- return Delivery{}, fmt.Errorf("cannot send mesage %s", err)
- }
- result := link.SendBytes(bytes)
- link.Advance()
- if result != len(bytes) {
- if result < 0 {
- return delivery, fmt.Errorf("send failed %v", PnErrorCode(result))
- } else {
- return delivery, fmt.Errorf("send incomplete %v of %v", result, len(bytes))
- }
- }
- if link.RemoteSndSettleMode() == SndSettled {
- delivery.Settle()
- }
- return delivery, nil
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go b/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go
deleted file mode 100644
index aad93eb..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/proton_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-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.
-*/
-
-package proton
-
-import (
- "fmt"
- "net"
- "path"
- "runtime"
- "testing"
- "time"
-)
-
-func errorIf(t *testing.T, err error) {
- if err != nil {
- _, file, line, ok := runtime.Caller(1) // annotate with location of caller.
- if ok {
- _, file = path.Split(file)
- }
- t.Errorf("(from %s:%d) %v", file, line, err)
- }
-}
-
-func fatalIf(t *testing.T, err error) {
- if err != nil {
- _, file, line, ok := runtime.Caller(1) // annotate with location of caller.
- if ok {
- _, file = path.Split(file)
- }
- t.Fatalf("(from %s:%d) %v", file, line, err)
- }
-}
-
-type events []EventType
-
-type testEngine struct {
- Engine
- events chan EventType
-}
-
-func newTestEngine(conn net.Conn) (*testEngine, error) {
- testEng := &testEngine{events: make(chan EventType, 1000)}
- return testEng, testEng.Initialize(conn, testEng)
-}
-
-func (eng *testEngine) HandleEvent(e Event) {
- eng.events <- e.Type()
-}
-
-func (eng *testEngine) expect(events []EventType) error {
- timer := time.After(5 * time.Second)
- for _, want := range events {
- select {
- case got := <-eng.events:
- if want != got {
- return fmt.Errorf("want %s, got %s", want, got)
- }
- case <-timer:
- return fmt.Errorf("expect timeout")
- }
- }
- return nil
-}
-
-func Test(t *testing.T) {
- cConn, sConn := net.Pipe()
- client, err := newTestEngine(cConn)
- fatalIf(t, err)
- server, err := newTestEngine(sConn)
- fatalIf(t, err)
- server.Server()
- go client.Run()
- go server.Run()
- fatalIf(t, server.expect(events{EConnectionInit, EConnectionBound}))
- fatalIf(t, client.expect(events{EConnectionInit, EConnectionBound}))
- fatalIf(t, client.InjectWait(func() error { client.Connection().Open(); return nil }))
- fatalIf(t, client.expect(events{EConnectionLocalOpen}))
- fatalIf(t, server.expect(events{EConnectionRemoteOpen}))
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/go/src/qpid.apache.org/proton/uuid.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/uuid.go b/proton-c/bindings/go/src/qpid.apache.org/proton/uuid.go
deleted file mode 100644
index f2dc70e..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/uuid.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-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.
-*/
-
-package proton
-
-import (
- "fmt"
- "math/rand"
- "sync"
- "time"
-)
-
-// UUID is a 16-byte Universally Unique Identifier
-type UUID [16]byte
-
-// String gives a UUID in standard string format.
-func (u UUID) String() string {
- return fmt.Sprintf("%X-%X-%X-%X-%X", u[0:4], u[4:6], u[6:8], u[8:10], u[10:])
-}
-
-// Don't mess with the default random source.
-var randomSource = rand.NewSource(time.Now().UnixNano())
-var randomLock sync.Mutex
-
-func random() byte {
- randomLock.Lock()
- defer randomLock.Unlock()
- return byte(randomSource.Int63())
-}
-
-// UUID4 returns a randomly-generated (version 4) UUID, as per RFC4122
-func UUID4() UUID {
- var u UUID
- for i := 0; i < len(u); i++ {
- u[i] = random()
- }
- // See /https://tools.ietf.org/html/rfc4122#section-4.4
- u[6] = (u[6] & 0x0F) | 0x40 // Version bits to 4
- u[8] = (u[8] & 0x3F) | 0x80 // Reserved bits (top two) set to 01
- return u
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go
deleted file mode 100644
index 4d55e4f..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
-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.
-*/
-
-// This file contains special-case wrapper functions or wrappers that don't follow
-// the pattern of genwrap.go.
-
-package proton
-
-//#include <proton/codec.h>
-//#include <proton/connection.h>
-//#include <proton/delivery.h>
-//#include <proton/event.h>
-//#include <proton/link.h>
-//#include <proton/link.h>
-//#include <proton/object.h>
-//#include <proton/sasl.h>
-//#include <proton/session.h>
-//#include <proton/transport.h>
-//#include <stdlib.h>
-import "C"
-
-import (
- "fmt"
- "qpid.apache.org/amqp"
- "reflect"
- "time"
- "unsafe"
-)
-
-// TODO aconway 2015-05-05: Documentation for generated types.
-
-// CHandle holds an unsafe.Pointer to a proton C struct, the C type depends on the
-// Go type implementing this interface. For low level, at-your-own-risk use only.
-type CHandle interface {
- // CPtr returns the unsafe C pointer, equivalent to a C void*.
- CPtr() unsafe.Pointer
-}
-
-// Incref increases the refcount of a proton value, which prevents the
-// underlying C struct being freed until you call Decref().
-//
-// It can be useful to "pin" a proton value in memory while it is in use by
-// goroutines other than the event loop goroutine. For example if you Incref() a
-// Link, the underlying object is not freed when the link is closed, so means
-// other goroutines can continue to safely use it as an index in a map or inject
-// it into the event loop goroutine. There will of course be an error if you try
-// to use a link after it is closed, but not a segmentation fault.
-func Incref(c CHandle) {
- if p := c.CPtr(); p != nil {
- C.pn_incref(p)
- }
-}
-
-// Decref decreases the refcount of a proton value, freeing the underlying C
-// struct if this is the last reference. Only call this if you previously
-// called Incref() for this value.
-func Decref(c CHandle) {
- if p := c.CPtr(); p != nil {
- C.pn_decref(p)
- }
-}
-
-// Event is an AMQP protocol event.
-type Event struct {
- pn *C.pn_event_t
- eventType EventType
- connection Connection
- transport Transport
- session Session
- link Link
- delivery Delivery
- injecter Injecter
-}
-
-func makeEvent(pn *C.pn_event_t, injecter Injecter) Event {
- return Event{
- pn: pn,
- eventType: EventType(C.pn_event_type(pn)),
- connection: Connection{C.pn_event_connection(pn)},
- transport: Transport{C.pn_event_transport(pn)},
- session: Session{C.pn_event_session(pn)},
- link: Link{C.pn_event_link(pn)},
- delivery: Delivery{C.pn_event_delivery(pn)},
- injecter: injecter,
- }
-}
-func (e Event) IsNil() bool { return e.eventType == EventType(0) }
-func (e Event) Type() EventType { return e.eventType }
-func (e Event) Connection() Connection { return e.connection }
-func (e Event) Transport() Transport { return e.transport }
-func (e Event) Session() Session { return e.session }
-func (e Event) Link() Link { return e.link }
-func (e Event) Delivery() Delivery { return e.delivery }
-func (e Event) String() string { return e.Type().String() }
-
-// Injecter should not be used in a handler function, but it can be passed to
-// other goroutines (via a channel or to a goroutine started by handler
-// functions) to let them inject functions back into the handlers goroutine.
-func (e Event) Injecter() Injecter { return e.injecter }
-
-// Data holds a pointer to decoded AMQP data.
-// Use amqp.marshal/unmarshal to access it as Go data types.
-//
-type Data struct{ pn *C.pn_data_t }
-
-func NewData(p unsafe.Pointer) Data { return Data{(*C.pn_data_t)(p)} }
-
-func (d Data) Free() { C.pn_data_free(d.pn) }
-func (d Data) Pointer() unsafe.Pointer { return unsafe.Pointer(d.pn) }
-func (d Data) Clear() { C.pn_data_clear(d.pn) }
-func (d Data) Rewind() { C.pn_data_rewind(d.pn) }
-func (d Data) Error() error { return PnError(C.pn_data_error(d.pn)) }
-
-// State holds the state flags for an AMQP endpoint.
-type State byte
-
-const (
- SLocalUninit State = C.PN_LOCAL_UNINIT
- SLocalActive = C.PN_LOCAL_ACTIVE
- SLocalClosed = C.PN_LOCAL_CLOSED
- SRemoteUninit = C.PN_REMOTE_UNINIT
- SRemoteActive = C.PN_REMOTE_ACTIVE
- SRemoteClosed = C.PN_REMOTE_CLOSED
-)
-
-// Has is True if bits & state is non 0.
-func (s State) Has(bits State) bool { return s&bits != 0 }
-
-func (s State) LocalUninit() bool { return s.Has(SLocalUninit) }
-func (s State) LocalActive() bool { return s.Has(SLocalActive) }
-func (s State) LocalClosed() bool { return s.Has(SLocalClosed) }
-func (s State) RemoteUninit() bool { return s.Has(SRemoteUninit) }
-func (s State) RemoteActive() bool { return s.Has(SRemoteActive) }
-func (s State) RemoteClosed() bool { return s.Has(SRemoteClosed) }
-
-// Return a State containig just the local flags
-func (s State) Local() State { return State(s & C.PN_LOCAL_MASK) }
-
-// Return a State containig just the remote flags
-func (s State) Remote() State { return State(s & C.PN_REMOTE_MASK) }
-
-// Endpoint is the common interface for Connection, Link and Session.
-type Endpoint interface {
- // State is the open/closed state.
- State() State
- // Open an endpoint.
- Open()
- // Close an endpoint.
- Close()
- // Condition holds a local error condition.
- Condition() Condition
- // RemoteCondition holds a remote error condition.
- RemoteCondition() Condition
- // Human readable name
- String() string
- // Human readable endpoint type "link", "session" etc.
- Type() string
-}
-
-// CloseError sets an error condition (if err != nil) on an endpoint and closes
-// the endpoint if not already closed
-func CloseError(e Endpoint, err error) {
- if err != nil {
- e.Condition().SetError(err)
- }
- e.Close()
-}
-
-// EndpointError returns the remote error if there is one, the local error if not
-// nil if there is no error.
-func EndpointError(e Endpoint) error {
- err := e.RemoteCondition().Error()
- if err == nil {
- err = e.Condition().Error()
- }
- return err
-}
-
-const (
- Received uint64 = C.PN_RECEIVED
- Accepted = C.PN_ACCEPTED
- Rejected = C.PN_REJECTED
- Released = C.PN_RELEASED
- Modified = C.PN_MODIFIED
-)
-
-// SettleAs is equivalent to d.Update(disposition); d.Settle()
-func (d Delivery) SettleAs(disposition uint64) {
- d.Update(disposition)
- d.Settle()
-}
-
-// Accept accepts and settles a delivery.
-func (d Delivery) Accept() { d.SettleAs(Accepted) }
-
-// Reject rejects and settles a delivery
-func (d Delivery) Reject() { d.SettleAs(Rejected) }
-
-// Release releases and settles a delivery
-// If delivered is true the delivery count for the message will be increased.
-func (d Delivery) Release(delivered bool) {
- if delivered {
- d.SettleAs(Modified)
- } else {
- d.SettleAs(Released)
- }
-}
-
-type DeliveryTag struct{ pn C.pn_delivery_tag_t }
-
-func (t DeliveryTag) String() string { return C.GoStringN(t.pn.start, C.int(t.pn.size)) }
-
-func (l Link) Recv(buf []byte) int {
- if len(buf) == 0 {
- return 0
- }
- return int(C.pn_link_recv(l.pn, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))))
-}
-
-func (l Link) SendBytes(bytes []byte) int {
- return int(C.pn_link_send(l.pn, cPtr(bytes), cLen(bytes)))
-}
-
-func pnTag(tag string) C.pn_delivery_tag_t {
- bytes := []byte(tag)
- return C.pn_dtag(cPtr(bytes), cLen(bytes))
-}
-
-func (l Link) Delivery(tag string) Delivery {
- return Delivery{C.pn_delivery(l.pn, pnTag(tag))}
-}
-
-func (l Link) Connection() Connection { return l.Session().Connection() }
-
-// Human-readable link description including name, source, target and direction.
-func (l Link) String() string {
- switch {
- case l.IsNil():
- return fmt.Sprintf("<nil-link>")
- case l.IsSender():
- return fmt.Sprintf("%s(%s->%s)", l.Name(), l.Source().Address(), l.Target().Address())
- default:
- return fmt.Sprintf("%s(%s<-%s)", l.Name(), l.Target().Address(), l.Source().Address())
- }
-}
-
-func (l Link) Type() string {
- if l.IsSender() {
- return "link(sender)"
- } else {
- return "link(receiver)"
- }
-}
-
-// IsDrain calls pn_link_get_drain(), it conflicts with pn_link_drain() under the normal mapping.
-func (l Link) IsDrain() bool {
- return bool(C.pn_link_get_drain(l.pn))
-}
-
-func cPtr(b []byte) *C.char {
- if len(b) == 0 {
- return nil
- }
- return (*C.char)(unsafe.Pointer(&b[0]))
-}
-
-func cLen(b []byte) C.size_t {
- return C.size_t(len(b))
-}
-
-func (s Session) Sender(name string) Link {
- cname := C.CString(name)
- defer C.free(unsafe.Pointer(cname))
- return Link{C.pn_sender(s.pn, cname)}
-}
-
-func (s Session) Receiver(name string) Link {
- cname := C.CString(name)
- defer C.free(unsafe.Pointer(cname))
- return Link{C.pn_receiver(s.pn, cname)}
-}
-
-func (t Transport) String() string {
- return fmt.Sprintf("(Transport)(%p)", t.CPtr())
-}
-
-// Unique (per process) string identifier for a connection, useful for debugging.
-func (c Connection) String() string {
- // Use the transport address to match the default transport logs from PN_TRACE.
- return fmt.Sprintf("(Connection)(%p)", c.Transport().CPtr())
-}
-
-func (c Connection) Type() string {
- return "connection"
-}
-
-// Head functions don't follow the normal naming conventions so missed by the generator.
-
-func (c Connection) LinkHead(s State) Link {
- return Link{C.pn_link_head(c.pn, C.pn_state_t(s))}
-}
-
-func (c Connection) SessionHead(s State) Session {
- return Session{C.pn_session_head(c.pn, C.pn_state_t(s))}
-}
-
-func (c Connection) Links(state State) (links []Link) {
- for l := c.LinkHead(state); !l.IsNil(); l = l.Next(state) {
- links = append(links, l)
- }
- return
-}
-
-func (c Connection) Sessions(state State) (sessions []Session) {
- for s := c.SessionHead(state); !s.IsNil(); s = s.Next(state) {
- sessions = append(sessions, s)
- }
- return
-}
-
-// SetPassword takes []byte not string because it is impossible to erase a string
-// from memory reliably. Proton will not keep the password in memory longer than
-// needed, the caller should overwrite their copy on return.
-//
-// The password must not contain embedded nul characters, a trailing nul is ignored.
-func (c Connection) SetPassword(password []byte) {
- if len(password) == 0 || password[len(password)-1] != 0 {
- password = append(password, 0) // Proton requires a terminating null.
- }
- C.pn_connection_set_password(c.pn, (*C.char)(unsafe.Pointer(&password[0])))
-}
-
-func (s Session) String() string {
- return fmt.Sprintf("(Session)(%p)", s.pn) // TODO aconway 2016-09-12: should print channel number.
-}
-
-func (s Session) Type() string { return "session" }
-
-// Error returns an instance of amqp.Error or nil.
-func (c Condition) Error() error {
- if c.IsNil() || !c.IsSet() {
- return nil
- }
- return amqp.Error{Name: c.Name(), Description: c.Description()}
-}
-
-// Set a Go error into a condition.
-// If it is not an amqp.Condition use the error type as name, error string as description.
-func (c Condition) SetError(err error) {
- if err != nil {
- if cond, ok := err.(amqp.Error); ok {
- c.SetName(cond.Name)
- c.SetDescription(cond.Description)
- } else {
- c.SetName(reflect.TypeOf(err).Name())
- c.SetDescription(err.Error())
- }
- }
-}
-
-func (c Connection) Session() (Session, error) {
- s := Session{C.pn_session(c.pn)}
- if s.IsNil() {
- return s, Connection(c).Error()
- }
- return s, nil
-}
-
-// pnTime converts Go time.Time to Proton millisecond Unix time.
-//
-// Note: t.isZero() is converted to C.pn_timestamp_t(0) and vice-versa. These
-// are used as "not set" sentinel values by the Go and Proton APIs, so it is
-// better to conserve the "zeroness" even though they don't represent the same
-// time instant.
-//
-func pnTime(t time.Time) (pnt C.pn_timestamp_t) {
- if !t.IsZero() {
- pnt = C.pn_timestamp_t(t.Unix()*1000 + int64(t.Nanosecond())/int64(time.Millisecond))
- }
- return
-}
-
-// goTime converts a pn_timestamp_t to a Go time.Time.
-//
-// Note: C.pn_timestamp_t(0) is converted to a zero time.Time and
-// vice-versa. These are used as "not set" sentinel values by the Go and Proton
-// APIs, so it is better to conserve the "zeroness" even though they don't
-// represent the same time instant.
-//
-func goTime(pnt C.pn_timestamp_t) (t time.Time) {
- if pnt != 0 {
- t = time.Unix(int64(pnt/1000), int64(pnt%1000)*int64(time.Millisecond))
- }
- return
-}
-
-// Special treatment for Transport.Head, return value is unsafe.Pointer not string
-func (t Transport) Head() unsafe.Pointer {
- return unsafe.Pointer(C.pn_transport_head(t.pn))
-}
-
-// Special treatment for Transport.Tail, return value is unsafe.Pointer not string
-func (t Transport) Tail() unsafe.Pointer {
- return unsafe.Pointer(C.pn_transport_tail(t.pn))
-}
-
-// Special treatment for Transport.Push, takes []byte instead of char*, size
-func (t Transport) Push(bytes []byte) int {
- return int(C.pn_transport_push(t.pn, (*C.char)(unsafe.Pointer(&bytes[0])), C.size_t(len(bytes))))
-}
-
-// Get the SASL object for the transport.
-func (t Transport) SASL() SASL {
- return SASL{C.pn_sasl(t.pn)}
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
deleted file mode 100644
index 19bfde2..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
+++ /dev/null
@@ -1,937 +0,0 @@
-/*
-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.
-*/
-
-//
-// NOTE: DO NOT EDIT. This file was generated by genwrap.go from the proton header files.
-// Update the generator and re-run if you need to modify this code.
-//
-
-package proton
-
-import (
- "time"
- "unsafe"
-)
-
-// #include <proton/types.h>
-// #include <proton/error.h>
-// #include <proton/condition.h>
-// #include <proton/event.h>
-// #include <stdlib.h>
-// #include <proton/session.h>
-// #include <proton/link.h>
-// #include <proton/delivery.h>
-// #include <proton/disposition.h>
-// #include <proton/condition.h>
-// #include <proton/terminus.h>
-// #include <proton/connection.h>
-// #include <proton/transport.h>
-// #include <proton/sasl.h>
-import "C"
-
-type EventType int
-
-const (
- EConnectionInit EventType = C.PN_CONNECTION_INIT
- EConnectionBound EventType = C.PN_CONNECTION_BOUND
- EConnectionUnbound EventType = C.PN_CONNECTION_UNBOUND
- EConnectionLocalOpen EventType = C.PN_CONNECTION_LOCAL_OPEN
- EConnectionRemoteOpen EventType = C.PN_CONNECTION_REMOTE_OPEN
- EConnectionLocalClose EventType = C.PN_CONNECTION_LOCAL_CLOSE
- EConnectionRemoteClose EventType = C.PN_CONNECTION_REMOTE_CLOSE
- EConnectionFinal EventType = C.PN_CONNECTION_FINAL
- ESessionInit EventType = C.PN_SESSION_INIT
- ESessionLocalOpen EventType = C.PN_SESSION_LOCAL_OPEN
- ESessionRemoteOpen EventType = C.PN_SESSION_REMOTE_OPEN
- ESessionLocalClose EventType = C.PN_SESSION_LOCAL_CLOSE
- ESessionRemoteClose EventType = C.PN_SESSION_REMOTE_CLOSE
- ESessionFinal EventType = C.PN_SESSION_FINAL
- ELinkInit EventType = C.PN_LINK_INIT
- ELinkLocalOpen EventType = C.PN_LINK_LOCAL_OPEN
- ELinkRemoteOpen EventType = C.PN_LINK_REMOTE_OPEN
- ELinkLocalClose EventType = C.PN_LINK_LOCAL_CLOSE
- ELinkRemoteClose EventType = C.PN_LINK_REMOTE_CLOSE
- ELinkLocalDetach EventType = C.PN_LINK_LOCAL_DETACH
- ELinkRemoteDetach EventType = C.PN_LINK_REMOTE_DETACH
- ELinkFlow EventType = C.PN_LINK_FLOW
- ELinkFinal EventType = C.PN_LINK_FINAL
- EDelivery EventType = C.PN_DELIVERY
- ETransport EventType = C.PN_TRANSPORT
- ETransportAuthenticated EventType = C.PN_TRANSPORT_AUTHENTICATED
- ETransportError EventType = C.PN_TRANSPORT_ERROR
- ETransportHeadClosed EventType = C.PN_TRANSPORT_HEAD_CLOSED
- ETransportTailClosed EventType = C.PN_TRANSPORT_TAIL_CLOSED
- ETransportClosed EventType = C.PN_TRANSPORT_CLOSED
-)
-
-func (e EventType) String() string {
- switch e {
-
- case C.PN_CONNECTION_INIT:
- return "ConnectionInit"
- case C.PN_CONNECTION_BOUND:
- return "ConnectionBound"
- case C.PN_CONNECTION_UNBOUND:
- return "ConnectionUnbound"
- case C.PN_CONNECTION_LOCAL_OPEN:
- return "ConnectionLocalOpen"
- case C.PN_CONNECTION_REMOTE_OPEN:
- return "ConnectionRemoteOpen"
- case C.PN_CONNECTION_LOCAL_CLOSE:
- return "ConnectionLocalClose"
- case C.PN_CONNECTION_REMOTE_CLOSE:
- return "ConnectionRemoteClose"
- case C.PN_CONNECTION_FINAL:
- return "ConnectionFinal"
- case C.PN_SESSION_INIT:
- return "SessionInit"
- case C.PN_SESSION_LOCAL_OPEN:
- return "SessionLocalOpen"
- case C.PN_SESSION_REMOTE_OPEN:
- return "SessionRemoteOpen"
- case C.PN_SESSION_LOCAL_CLOSE:
- return "SessionLocalClose"
- case C.PN_SESSION_REMOTE_CLOSE:
- return "SessionRemoteClose"
- case C.PN_SESSION_FINAL:
- return "SessionFinal"
- case C.PN_LINK_INIT:
- return "LinkInit"
- case C.PN_LINK_LOCAL_OPEN:
- return "LinkLocalOpen"
- case C.PN_LINK_REMOTE_OPEN:
- return "LinkRemoteOpen"
- case C.PN_LINK_LOCAL_CLOSE:
- return "LinkLocalClose"
- case C.PN_LINK_REMOTE_CLOSE:
- return "LinkRemoteClose"
- case C.PN_LINK_LOCAL_DETACH:
- return "LinkLocalDetach"
- case C.PN_LINK_REMOTE_DETACH:
- return "LinkRemoteDetach"
- case C.PN_LINK_FLOW:
- return "LinkFlow"
- case C.PN_LINK_FINAL:
- return "LinkFinal"
- case C.PN_DELIVERY:
- return "Delivery"
- case C.PN_TRANSPORT:
- return "Transport"
- case C.PN_TRANSPORT_AUTHENTICATED:
- return "TransportAuthenticated"
- case C.PN_TRANSPORT_ERROR:
- return "TransportError"
- case C.PN_TRANSPORT_HEAD_CLOSED:
- return "TransportHeadClosed"
- case C.PN_TRANSPORT_TAIL_CLOSED:
- return "TransportTailClosed"
- case C.PN_TRANSPORT_CLOSED:
- return "TransportClosed"
- }
- return "Unknown"
-}
-
-// Wrappers for declarations in session.h
-
-type Session struct{ pn *C.pn_session_t }
-
-func (s Session) IsNil() bool { return s.pn == nil }
-func (s Session) CPtr() unsafe.Pointer { return unsafe.Pointer(s.pn) }
-func (s Session) Free() {
- C.pn_session_free(s.pn)
-}
-func (s Session) State() State {
- return State(C.pn_session_state(s.pn))
-}
-func (s Session) Error() error {
- return PnError(C.pn_session_error(s.pn))
-}
-func (s Session) Condition() Condition {
- return Condition{C.pn_session_condition(s.pn)}
-}
-func (s Session) RemoteCondition() Condition {
- return Condition{C.pn_session_remote_condition(s.pn)}
-}
-func (s Session) Connection() Connection {
- return Connection{C.pn_session_connection(s.pn)}
-}
-func (s Session) Open() {
- C.pn_session_open(s.pn)
-}
-func (s Session) Close() {
- C.pn_session_close(s.pn)
-}
-func (s Session) IncomingCapacity() uint {
- return uint(C.pn_session_get_incoming_capacity(s.pn))
-}
-func (s Session) SetIncomingCapacity(capacity uint) {
- C.pn_session_set_incoming_capacity(s.pn, C.size_t(capacity))
-}
-func (s Session) OutgoingWindow() uint {
- return uint(C.pn_session_get_outgoing_window(s.pn))
-}
-func (s Session) SetOutgoingWindow(window uint) {
- C.pn_session_set_outgoing_window(s.pn, C.size_t(window))
-}
-func (s Session) OutgoingBytes() uint {
- return uint(C.pn_session_outgoing_bytes(s.pn))
-}
-func (s Session) IncomingBytes() uint {
- return uint(C.pn_session_incoming_bytes(s.pn))
-}
-func (s Session) Next(state State) Session {
- return Session{C.pn_session_next(s.pn, C.pn_state_t(state))}
-}
-
-// Wrappers for declarations in link.h
-
-type SndSettleMode C.pn_snd_settle_mode_t
-
-const (
- SndUnsettled SndSettleMode = C.PN_SND_UNSETTLED
- SndSettled SndSettleMode = C.PN_SND_SETTLED
- SndMixed SndSettleMode = C.PN_SND_MIXED
-)
-
-func (e SndSettleMode) String() string {
- switch e {
-
- case C.PN_SND_UNSETTLED:
- return "SndUnsettled"
- case C.PN_SND_SETTLED:
- return "SndSettled"
- case C.PN_SND_MIXED:
- return "SndMixed"
- }
- return "unknown"
-}
-
-type RcvSettleMode C.pn_rcv_settle_mode_t
-
-const (
- RcvFirst RcvSettleMode = C.PN_RCV_FIRST
- RcvSecond RcvSettleMode = C.PN_RCV_SECOND
-)
-
-func (e RcvSettleMode) String() string {
- switch e {
-
- case C.PN_RCV_FIRST:
- return "RcvFirst"
- case C.PN_RCV_SECOND:
- return "RcvSecond"
- }
- return "unknown"
-}
-
-type Link struct{ pn *C.pn_link_t }
-
-func (l Link) IsNil() bool { return l.pn == nil }
-func (l Link) CPtr() unsafe.Pointer { return unsafe.Pointer(l.pn) }
-func (l Link) Free() {
- C.pn_link_free(l.pn)
-}
-func (l Link) Name() string {
- return C.GoString(C.pn_link_name(l.pn))
-}
-func (l Link) IsSender() bool {
- return bool(C.pn_link_is_sender(l.pn))
-}
-func (l Link) IsReceiver() bool {
- return bool(C.pn_link_is_receiver(l.pn))
-}
-func (l Link) State() State {
- return State(C.pn_link_state(l.pn))
-}
-func (l Link) Error() error {
- return PnError(C.pn_link_error(l.pn))
-}
-func (l Link) Condition() Condition {
- return Condition{C.pn_link_condition(l.pn)}
-}
-func (l Link) RemoteCondition() Condition {
- return Condition{C.pn_link_remote_condition(l.pn)}
-}
-func (l Link) Session() Session {
- return Session{C.pn_link_session(l.pn)}
-}
-func (l Link) Next(state State) Link {
- return Link{C.pn_link_next(l.pn, C.pn_state_t(state))}
-}
-func (l Link) Open() {
- C.pn_link_open(l.pn)
-}
-func (l Link) Close() {
- C.pn_link_close(l.pn)
-}
-func (l Link) Detach() {
- C.pn_link_detach(l.pn)
-}
-func (l Link) Source() Terminus {
- return Terminus{C.pn_link_source(l.pn)}
-}
-func (l Link) Target() Terminus {
- return Terminus{C.pn_link_target(l.pn)}
-}
-func (l Link) RemoteSource() Terminus {
- return Terminus{C.pn_link_remote_source(l.pn)}
-}
-func (l Link) RemoteTarget() Terminus {
- return Terminus{C.pn_link_remote_target(l.pn)}
-}
-func (l Link) Current() Delivery {
- return Delivery{C.pn_link_current(l.pn)}
-}
-func (l Link) Advance() bool {
- return bool(C.pn_link_advance(l.pn))
-}
-func (l Link) Credit() int {
- return int(C.pn_link_credit(l.pn))
-}
-func (l Link) Queued() int {
- return int(C.pn_link_queued(l.pn))
-}
-func (l Link) RemoteCredit() int {
- return int(C.pn_link_remote_credit(l.pn))
-}
-func (l Link) Drained() int {
- return int(C.pn_link_drained(l.pn))
-}
-func (l Link) Available() int {
- return int(C.pn_link_available(l.pn))
-}
-func (l Link) SndSettleMode() SndSettleMode {
- return SndSettleMode(C.pn_link_snd_settle_mode(l.pn))
-}
-func (l Link) RcvSettleMode() RcvSettleMode {
- return RcvSettleMode(C.pn_link_rcv_settle_mode(l.pn))
-}
-func (l Link) SetSndSettleMode(mode SndSettleMode) {
- C.pn_link_set_snd_settle_mode(l.pn, C.pn_snd_settle_mode_t(mode))
-}
-func (l Link) SetRcvSettleMode(mode RcvSettleMode) {
- C.pn_link_set_rcv_settle_mode(l.pn, C.pn_rcv_settle_mode_t(mode))
-}
-func (l Link) RemoteSndSettleMode() SndSettleMode {
- return SndSettleMode(C.pn_link_remote_snd_settle_mode(l.pn))
-}
-func (l Link) RemoteRcvSettleMode() RcvSettleMode {
- return RcvSettleMode(C.pn_link_remote_rcv_settle_mode(l.pn))
-}
-func (l Link) Unsettled() int {
- return int(C.pn_link_unsettled(l.pn))
-}
-func (l Link) Offered(credit int) {
- C.pn_link_offered(l.pn, C.int(credit))
-}
-func (l Link) Flow(credit int) {
- C.pn_link_flow(l.pn, C.int(credit))
-}
-func (l Link) Drain(credit int) {
- C.pn_link_drain(l.pn, C.int(credit))
-}
-func (l Link) SetDrain(drain bool) {
- C.pn_link_set_drain(l.pn, C.bool(drain))
-}
-func (l Link) Draining() bool {
- return bool(C.pn_link_draining(l.pn))
-}
-
-// Wrappers for declarations in delivery.h
-
-type Delivery struct{ pn *C.pn_delivery_t }
-
-func (d Delivery) IsNil() bool { return d.pn == nil }
-func (d Delivery) CPtr() unsafe.Pointer { return unsafe.Pointer(d.pn) }
-func (d Delivery) Tag() DeliveryTag {
- return DeliveryTag{C.pn_delivery_tag(d.pn)}
-}
-func (d Delivery) Link() Link {
- return Link{C.pn_delivery_link(d.pn)}
-}
-func (d Delivery) Local() Disposition {
- return Disposition{C.pn_delivery_local(d.pn)}
-}
-func (d Delivery) LocalState() uint64 {
- return uint64(C.pn_delivery_local_state(d.pn))
-}
-func (d Delivery) Remote() Disposition {
- return Disposition{C.pn_delivery_remote(d.pn)}
-}
-func (d Delivery) RemoteState() uint64 {
- return uint64(C.pn_delivery_remote_state(d.pn))
-}
-func (d Delivery) Settled() bool {
- return bool(C.pn_delivery_settled(d.pn))
-}
-func (d Delivery) Pending() uint {
- return uint(C.pn_delivery_pending(d.pn))
-}
-func (d Delivery) Partial() bool {
- return bool(C.pn_delivery_partial(d.pn))
-}
-func (d Delivery) Writable() bool {
- return bool(C.pn_delivery_writable(d.pn))
-}
-func (d Delivery) Readable() bool {
- return bool(C.pn_delivery_readable(d.pn))
-}
-func (d Delivery) Updated() bool {
- return bool(C.pn_delivery_updated(d.pn))
-}
-func (d Delivery) Update(state uint64) {
- C.pn_delivery_update(d.pn, C.uint64_t(state))
-}
-func (d Delivery) Clear() {
- C.pn_delivery_clear(d.pn)
-}
-func (d Delivery) Current() bool {
- return bool(C.pn_delivery_current(d.pn))
-}
-func (d Delivery) Settle() {
- C.pn_delivery_settle(d.pn)
-}
-func (d Delivery) Dump() {
- C.pn_delivery_dump(d.pn)
-}
-func (d Delivery) Buffered() bool {
- return bool(C.pn_delivery_buffered(d.pn))
-}
-
-// Wrappers for declarations in disposition.h
-
-type Disposition struct{ pn *C.pn_disposition_t }
-
-func (d Disposition) IsNil() bool { return d.pn == nil }
-func (d Disposition) CPtr() unsafe.Pointer { return unsafe.Pointer(d.pn) }
-func (d Disposition) Type() uint64 {
- return uint64(C.pn_disposition_type(d.pn))
-}
-func (d Disposition) Condition() Condition {
- return Condition{C.pn_disposition_condition(d.pn)}
-}
-func (d Disposition) Data() Data {
- return Data{C.pn_disposition_data(d.pn)}
-}
-func (d Disposition) SectionNumber() uint16 {
- return uint16(C.pn_disposition_get_section_number(d.pn))
-}
-func (d Disposition) SetSectionNumber(section_number uint16) {
- C.pn_disposition_set_section_number(d.pn, C.uint32_t(section_number))
-}
-func (d Disposition) SectionOffset() uint64 {
- return uint64(C.pn_disposition_get_section_offset(d.pn))
-}
-func (d Disposition) SetSectionOffset(section_offset uint64) {
- C.pn_disposition_set_section_offset(d.pn, C.uint64_t(section_offset))
-}
-func (d Disposition) IsFailed() bool {
- return bool(C.pn_disposition_is_failed(d.pn))
-}
-func (d Disposition) SetFailed(failed bool) {
- C.pn_disposition_set_failed(d.pn, C.bool(failed))
-}
-func (d Disposition) IsUndeliverable() bool {
- return bool(C.pn_disposition_is_undeliverable(d.pn))
-}
-func (d Disposition) SetUndeliverable(undeliverable bool) {
- C.pn_disposition_set_undeliverable(d.pn, C.bool(undeliverable))
-}
-func (d Disposition) Annotations() Data {
- return Data{C.pn_disposition_annotations(d.pn)}
-}
-
-// Wrappers for declarations in condition.h
-
-type Condition struct{ pn *C.pn_condition_t }
-
-func (c Condition) IsNil() bool { return c.pn == nil }
-func (c Condition) CPtr() unsafe.Pointer { return unsafe.Pointer(c.pn) }
-func (c Condition) IsSet() bool {
- return bool(C.pn_condition_is_set(c.pn))
-}
-func (c Condition) Clear() {
- C.pn_condition_clear(c.pn)
-}
-func (c Condition) Name() string {
- return C.GoString(C.pn_condition_get_name(c.pn))
-}
-func (c Condition) SetName(name string) int {
- nameC := C.CString(name)
- defer C.free(unsafe.Pointer(nameC))
-
- return int(C.pn_condition_set_name(c.pn, nameC))
-}
-func (c Condition) Description() string {
- return C.GoString(C.pn_condition_get_description(c.pn))
-}
-func (c Condition) SetDescription(description string) int {
- descriptionC := C.CString(description)
- defer C.free(unsafe.Pointer(descriptionC))
-
- return int(C.pn_condition_set_description(c.pn, descriptionC))
-}
-func (c Condition) Info() Data {
- return Data{C.pn_condition_info(c.pn)}
-}
-func (c Condition) IsRedirect() bool {
- return bool(C.pn_condition_is_redirect(c.pn))
-}
-func (c Condition) RedirectHost() string {
- return C.GoString(C.pn_condition_redirect_host(c.pn))
-}
-func (c Condition) RedirectPort() int {
- return int(C.pn_condition_redirect_port(c.pn))
-}
-
-// Wrappers for declarations in terminus.h
-
-type TerminusType C.pn_terminus_type_t
-
-const (
- Unspecified TerminusType = C.PN_UNSPECIFIED
- Source TerminusType = C.PN_SOURCE
- Target TerminusType = C.PN_TARGET
- Coordinator TerminusType = C.PN_COORDINATOR
-)
-
-func (e TerminusType) String() string {
- switch e {
-
- case C.PN_UNSPECIFIED:
- return "Unspecified"
- case C.PN_SOURCE:
- return "Source"
- case C.PN_TARGET:
- return "Target"
- case C.PN_COORDINATOR:
- return "Coordinator"
- }
- return "unknown"
-}
-
-type Durability C.pn_durability_t
-
-const (
- Nondurable Durability = C.PN_NONDURABLE
- Configuration Durability = C.PN_CONFIGURATION
- Deliveries Durability = C.PN_DELIVERIES
-)
-
-func (e Durability) String() string {
- switch e {
-
- case C.PN_NONDURABLE:
- return "Nondurable"
- case C.PN_CONFIGURATION:
- return "Configuration"
- case C.PN_DELIVERIES:
- return "Deliveries"
- }
- return "unknown"
-}
-
-type ExpiryPolicy C.pn_expiry_policy_t
-
-const (
- ExpireWithLink ExpiryPolicy = C.PN_EXPIRE_WITH_LINK
- ExpireWithSession ExpiryPolicy = C.PN_EXPIRE_WITH_SESSION
- ExpireWithConnection ExpiryPolicy = C.PN_EXPIRE_WITH_CONNECTION
- ExpireNever ExpiryPolicy = C.PN_EXPIRE_NEVER
-)
-
-func (e ExpiryPolicy) String() string {
- switch e {
-
- case C.PN_EXPIRE_WITH_LINK:
- return "ExpireWithLink"
- case C.PN_EXPIRE_WITH_SESSION:
- return "ExpireWithSession"
- case C.PN_EXPIRE_WITH_CONNECTION:
- return "ExpireWithConnection"
- case C.PN_EXPIRE_NEVER:
- return "ExpireNever"
- }
- return "unknown"
-}
-
-type DistributionMode C.pn_distribution_mode_t
-
-const (
- DistModeUnspecified DistributionMode = C.PN_DIST_MODE_UNSPECIFIED
- DistModeCopy DistributionMode = C.PN_DIST_MODE_COPY
- DistModeMove DistributionMode = C.PN_DIST_MODE_MOVE
-)
-
-func (e DistributionMode) String() string {
- switch e {
-
- case C.PN_DIST_MODE_UNSPECIFIED:
- return "DistModeUnspecified"
- case C.PN_DIST_MODE_COPY:
- return "DistModeCopy"
- case C.PN_DIST_MODE_MOVE:
- return "DistModeMove"
- }
- return "unknown"
-}
-
-type Terminus struct{ pn *C.pn_terminus_t }
-
-func (t Terminus) IsNil() bool { return t.pn == nil }
-func (t Terminus) CPtr() unsafe.Pointer { return unsafe.Pointer(t.pn) }
-func (t Terminus) Type() TerminusType {
- return TerminusType(C.pn_terminus_get_type(t.pn))
-}
-func (t Terminus) SetType(type_ TerminusType) int {
- return int(C.pn_terminus_set_type(t.pn, C.pn_terminus_type_t(type_)))
-}
-func (t Terminus) Address() string {
- return C.GoString(C.pn_terminus_get_address(t.pn))
-}
-func (t Terminus) SetAddress(address string) int {
- addressC := C.CString(address)
- defer C.free(unsafe.Pointer(addressC))
-
- return int(C.pn_terminus_set_address(t.pn, addressC))
-}
-func (t Terminus) SetDistributionMode(mode DistributionMode) int {
- return int(C.pn_terminus_set_distribution_mode(t.pn, C.pn_distribution_mode_t(mode)))
-}
-func (t Terminus) Durability() Durability {
- return Durability(C.pn_terminus_get_durability(t.pn))
-}
-func (t Terminus) SetDurability(durability Durability) int {
- return int(C.pn_terminus_set_durability(t.pn, C.pn_durability_t(durability)))
-}
-func (t Terminus) ExpiryPolicy() ExpiryPolicy {
- return ExpiryPolicy(C.pn_terminus_get_expiry_policy(t.pn))
-}
-func (t Terminus) SetExpiryPolicy(policy ExpiryPolicy) int {
- return int(C.pn_terminus_set_expiry_policy(t.pn, C.pn_expiry_policy_t(policy)))
-}
-func (t Terminus) Timeout() time.Duration {
- return (time.Duration(C.pn_terminus_get_timeout(t.pn)) * time.Second)
-}
-func (t Terminus) SetTimeout(timeout time.Duration) int {
- return int(C.pn_terminus_set_timeout(t.pn, C.pn_seconds_t(timeout)))
-}
-func (t Terminus) IsDynamic() bool {
- return bool(C.pn_terminus_is_dynamic(t.pn))
-}
-func (t Terminus) SetDynamic(dynamic bool) int {
- return int(C.pn_terminus_set_dynamic(t.pn, C.bool(dynamic)))
-}
-func (t Terminus) Properties() Data {
- return Data{C.pn_terminus_properties(t.pn)}
-}
-func (t Terminus) Capabilities() Data {
- return Data{C.pn_terminus_capabilities(t.pn)}
-}
-func (t Terminus) Outcomes() Data {
- return Data{C.pn_terminus_outcomes(t.pn)}
-}
-func (t Terminus) Filter() Data {
- return Data{C.pn_terminus_filter(t.pn)}
-}
-func (t Terminus) Copy(src Terminus) int {
- return int(C.pn_terminus_copy(t.pn, src.pn))
-}
-
-// Wrappers for declarations in connection.h
-
-type Connection struct{ pn *C.pn_connection_t }
-
-func (c Connection) IsNil() bool { return c.pn == nil }
-func (c Connection) CPtr() unsafe.Pointer { return unsafe.Pointer(c.pn) }
-func (c Connection) Free() {
- C.pn_connection_free(c.pn)
-}
-func (c Connection) Release() {
- C.pn_connection_release(c.pn)
-}
-func (c Connection) Error() error {
- return PnError(C.pn_connection_error(c.pn))
-}
-func (c Connection) State() State {
- return State(C.pn_connection_state(c.pn))
-}
-func (c Connection) Open() {
- C.pn_connection_open(c.pn)
-}
-func (c Connection) Close() {
- C.pn_connection_close(c.pn)
-}
-func (c Connection) Reset() {
- C.pn_connection_reset(c.pn)
-}
-func (c Connection) Condition() Condition {
- return Condition{C.pn_connection_condition(c.pn)}
-}
-func (c Connection) RemoteCondition() Condition {
- return Condition{C.pn_connection_remote_condition(c.pn)}
-}
-func (c Connection) Container() string {
- return C.GoString(C.pn_connection_get_container(c.pn))
-}
-func (c Connection) SetContainer(container string) {
- containerC := C.CString(container)
- defer C.free(unsafe.Pointer(containerC))
-
- C.pn_connection_set_container(c.pn, containerC)
-}
-func (c Connection) SetUser(user string) {
- userC := C.CString(user)
- defer C.free(unsafe.Pointer(userC))
-
- C.pn_connection_set_user(c.pn, userC)
-}
-func (c Connection) User() string {
- return C.GoString(C.pn_connection_get_user(c.pn))
-}
-func (c Connection) Hostname() string {
- return C.GoString(C.pn_connection_get_hostname(c.pn))
-}
-func (c Connection) SetHostname(hostname string) {
- hostnameC := C.CString(hostname)
- defer C.free(unsafe.Pointer(hostnameC))
-
- C.pn_connection_set_hostname(c.pn, hostnameC)
-}
-func (c Connection) RemoteContainer() string {
- return C.GoString(C.pn_connection_remote_container(c.pn))
-}
-func (c Connection) RemoteHostname() string {
- return C.GoString(C.pn_connection_remote_hostname(c.pn))
-}
-func (c Connection) OfferedCapabilities() Data {
- return Data{C.pn_connection_offered_capabilities(c.pn)}
-}
-func (c Connection) DesiredCapabilities() Data {
- return Data{C.pn_connection_desired_capabilities(c.pn)}
-}
-func (c Connection) Properties() Data {
- return Data{C.pn_connection_properties(c.pn)}
-}
-func (c Connection) RemoteOfferedCapabilities() Data {
- return Data{C.pn_connection_remote_offered_capabilities(c.pn)}
-}
-func (c Connection) RemoteDesiredCapabilities() Data {
- return Data{C.pn_connection_remote_desired_capabilities(c.pn)}
-}
-func (c Connection) RemoteProperties() Data {
- return Data{C.pn_connection_remote_properties(c.pn)}
-}
-func (c Connection) Transport() Transport {
- return Transport{C.pn_connection_transport(c.pn)}
-}
-
-// Wrappers for declarations in transport.h
-
-type Transport struct{ pn *C.pn_transport_t }
-
-func (t Transport) IsNil() bool { return t.pn == nil }
-func (t Transport) CPtr() unsafe.Pointer { return unsafe.Pointer(t.pn) }
-func (t Transport) SetServer() {
- C.pn_transport_set_server(t.pn)
-}
-func (t Transport) Free() {
- C.pn_transport_free(t.pn)
-}
-func (t Transport) User() string {
- return C.GoString(C.pn_transport_get_user(t.pn))
-}
-func (t Transport) RequireAuth(required bool) {
- C.pn_transport_require_auth(t.pn, C.bool(required))
-}
-func (t Transport) IsAuthenticated() bool {
- return bool(C.pn_transport_is_authenticated(t.pn))
-}
-func (t Transport) RequireEncryption(required bool) {
- C.pn_transport_require_encryption(t.pn, C.bool(required))
-}
-func (t Transport) IsEncrypted() bool {
- return bool(C.pn_transport_is_encrypted(t.pn))
-}
-func (t Transport) Condition() Condition {
- return Condition{C.pn_transport_condition(t.pn)}
-}
-func (t Transport) Error() error {
- return PnError(C.pn_transport_error(t.pn))
-}
-func (t Transport) Bind(connection Connection) int {
- return int(C.pn_transport_bind(t.pn, connection.pn))
-}
-func (t Transport) Unbind() int {
- return int(C.pn_transport_unbind(t.pn))
-}
-func (t Transport) Log(message string) {
- messageC := C.CString(message)
- defer C.free(unsafe.Pointer(messageC))
-
- C.pn_transport_log(t.pn, messageC)
-}
-func (t Transport) ChannelMax() uint32 {
- return uint32(C.pn_transport_get_channel_max(t.pn))
-}
-func (t Transport) SetChannelMax(channel_max uint32) int {
- return int(C.pn_transport_set_channel_max(t.pn, C.uint16_t(channel_max)))
-}
-func (t Transport) RemoteChannelMax() uint32 {
- return uint32(C.pn_transport_remote_channel_max(t.pn))
-}
-func (t Transport) MaxFrame() uint16 {
- return uint16(C.pn_transport_get_max_frame(t.pn))
-}
-func (t Transport) SetMaxFrame(size uint16) {
- C.pn_transport_set_max_frame(t.pn, C.uint32_t(size))
-}
-func (t Transport) RemoteMaxFrame() uint16 {
- return uint16(C.pn_transport_get_remote_max_frame(t.pn))
-}
-func (t Transport) IdleTimeout() time.Duration {
- return (time.Duration(C.pn_transport_get_idle_timeout(t.pn)) * time.Millisecond)
-}
-func (t Transport) SetIdleTimeout(timeout time.Duration) {
- C.pn_transport_set_idle_timeout(t.pn, C.pn_millis_t(timeout/time.Millisecond))
-}
-func (t Transport) RemoteIdleTimeout() time.Duration {
- return (time.Duration(C.pn_transport_get_remote_idle_timeout(t.pn)) * time.Millisecond)
-}
-func (t Transport) Input(bytes string, available uint) int {
- bytesC := C.CString(bytes)
- defer C.free(unsafe.Pointer(bytesC))
-
- return int(C.pn_transport_input(t.pn, bytesC, C.size_t(available)))
-}
-func (t Transport) Output(bytes string, size uint) int {
- bytesC := C.CString(bytes)
- defer C.free(unsafe.Pointer(bytesC))
-
- return int(C.pn_transport_output(t.pn, bytesC, C.size_t(size)))
-}
-func (t Transport) Capacity() int {
- return int(C.pn_transport_capacity(t.pn))
-}
-func (t Transport) Process(size uint) int {
- return int(C.pn_transport_process(t.pn, C.size_t(size)))
-}
-func (t Transport) CloseTail() int {
- return int(C.pn_transport_close_tail(t.pn))
-}
-func (t Transport) Pending() int {
- return int(C.pn_transport_pending(t.pn))
-}
-func (t Transport) Peek(dst string, size uint) int {
- dstC := C.CString(dst)
- defer C.free(unsafe.Pointer(dstC))
-
- return int(C.pn_transport_peek(t.pn, dstC, C.size_t(size)))
-}
-func (t Transport) Pop(size uint) {
- C.pn_transport_pop(t.pn, C.size_t(size))
-}
-func (t Transport) CloseHead() int {
- return int(C.pn_transport_close_head(t.pn))
-}
-func (t Transport) Quiesced() bool {
- return bool(C.pn_transport_quiesced(t.pn))
-}
-func (t Transport) Closed() bool {
- return bool(C.pn_transport_closed(t.pn))
-}
-func (t Transport) Tick(now time.Time) time.Time {
- return goTime(C.pn_transport_tick(t.pn, pnTime(now)))
-}
-func (t Transport) Connection() Connection {
- return Connection{C.pn_transport_connection(t.pn)}
-}
-
-// Wrappers for declarations in sasl.h
-
-type SASLOutcome C.pn_sasl_outcome_t
-
-const (
- SASLNone SASLOutcome = C.PN_SASL_NONE
- SASLOk SASLOutcome = C.PN_SASL_OK
- SASLAuth SASLOutcome = C.PN_SASL_AUTH
- SASLSys SASLOutcome = C.PN_SASL_SYS
- SASLPerm SASLOutcome = C.PN_SASL_PERM
- SASLTemp SASLOutcome = C.PN_SASL_TEMP
-)
-
-func (e SASLOutcome) String() string {
- switch e {
-
- case C.PN_SASL_NONE:
- return "SASLNone"
- case C.PN_SASL_OK:
- return "SASLOk"
- case C.PN_SASL_AUTH:
- return "SASLAuth"
- case C.PN_SASL_SYS:
- return "SASLSys"
- case C.PN_SASL_PERM:
- return "SASLPerm"
- case C.PN_SASL_TEMP:
- return "SASLTemp"
- }
- return "unknown"
-}
-
-type SASL struct{ pn *C.pn_sasl_t }
-
-func (s SASL) IsNil() bool { return s.pn == nil }
-func (s SASL) CPtr() unsafe.Pointer { return unsafe.Pointer(s.pn) }
-func (s SASL) Done(outcome SASLOutcome) {
- C.pn_sasl_done(s.pn, C.pn_sasl_outcome_t(outcome))
-}
-func (s SASL) Outcome() SASLOutcome {
- return SASLOutcome(C.pn_sasl_outcome(s.pn))
-}
-func (s SASL) User() string {
- return C.GoString(C.pn_sasl_get_user(s.pn))
-}
-func (s SASL) Mech() string {
- return C.GoString(C.pn_sasl_get_mech(s.pn))
-}
-func (s SASL) AllowedMechs(mechs string) {
- mechsC := C.CString(mechs)
- defer C.free(unsafe.Pointer(mechsC))
-
- C.pn_sasl_allowed_mechs(s.pn, mechsC)
-}
-func (s SASL) SetAllowInsecureMechs(insecure bool) {
- C.pn_sasl_set_allow_insecure_mechs(s.pn, C.bool(insecure))
-}
-func (s SASL) AllowInsecureMechs() bool {
- return bool(C.pn_sasl_get_allow_insecure_mechs(s.pn))
-}
-func (s SASL) ConfigName(name string) {
- nameC := C.CString(name)
- defer C.free(unsafe.Pointer(nameC))
-
- C.pn_sasl_config_name(s.pn, nameC)
-}
-func (s SASL) ConfigPath(path string) {
- pathC := C.CString(path)
- defer C.free(unsafe.Pointer(pathC))
-
- C.pn_sasl_config_path(s.pn, pathC)
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md b/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md
deleted file mode 100644
index 6eb1e2b..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md
+++ /dev/null
@@ -1,18 +0,0 @@
-The go-only subtree of proton is maintained on the branch `go1` for the `go get`
-command. `go1` is special to the `go get` command, it will use that branch
-rather than `master` when it is present.
-
-Created with:
-
- git subtree split --prefix=proton-c/bindings/go/src/qpid.apache.org -b go1
-
-Update with:
-
- git checkout go1
- git merge -s recursive -Xsubtree=proton-c/bindings/go/src/qpid.apache.org master
-
-To see the branch description: `git config branch.go1.description`
-
-NOTE: when updating the branch, you should also visit the doc pages at
-https://godoc.org/?q=qpid.apache.org and click "Refresh now" at the bottom of
-the page
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/javascript/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/javascript/CMakeLists.txt b/proton-c/bindings/javascript/CMakeLists.txt
deleted file mode 100644
index 971097c..0000000
--- a/proton-c/bindings/javascript/CMakeLists.txt
+++ /dev/null
@@ -1,279 +0,0 @@
-#
-# 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.
-#
-
-# This file allows cross-compiling of proton to JavaScript using emscripten
-# (https://github.com/kripken/emscripten). As it is really a cross-compilation
-# (as opposed to a binding like with swig) the approach is rather different and
-# somewhat replicates the main build in the proton-c/CMakeLists.txt using quite
-# a bit of "copy and paste reuse".
-# TODO refactor this file (and proton-c/CMakeLists.txt) to keep the main
-# compilation and cross-compilation consistent.
-
-message(STATUS "Found emscripten, using that to build JavaScript binding")
-
-# Find and install the node.js packages that we might need. We can assume that
-# node.js itself is installed because Emscripten has a dependency on it.
-find_package(NodePackages)
-
-# Describe the target OS we are building to - Emscripten mimics the Linux platform.
-set(CMAKE_SYSTEM_NAME Linux)
-set(CMAKE_SYSTEM_VERSION 1)
-set(CMAKE_CROSSCOMPILING TRUE)
-
-# Specify the compiler to use for cross-compilation.
-set(CMAKE_C_COMPILER "${EMCC}")
-
-# Don't do compiler autodetection, since we are cross-compiling.
-include(CMakeForceCompiler)
-CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" Clang)
-
-# The Proton default build type is RelWithDebInfo, but for JavaScript the C debug
-# mechanism is irrelevant. If Debug is explicitly set we turn off optimisations
-# and don't run the closure compiler so any error/profiling messages are readable.
-if (CMAKE_BUILD_TYPE STREQUAL "Debug")
- message(STATUS "JavaScript build type is \"Debug\"")
-else()
- set(CMAKE_BUILD_TYPE Release)
- message(STATUS "JavaScript build type is \"Release\"")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
- set(EMSCRIPTEN_LINK_OPTIMISATIONS "-O2 --closure 1")
-endif()
-
-# From this point we should be using emscripten compilation tools.
-message(STATUS "emscripten compilation environment:")
-message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-
-
-# Set this to the proton-c directory, we're cross-compiling code from there.
-set(PN_PATH ${CMAKE_SOURCE_DIR}/proton-c)
-
-
-# TODO the OpenSSL stuff won't work for emscripten by default. It might well be
-# possible to compile it from source using emscripten (that's the standard practice
-# for libraries with emscripten) see https://github.com/kripken/emscripten/wiki/FAQ
-# "Q. How do I link against system libraries like SDL, boost, etc.?"
-# Though it might be more natural to simply use a TLS protected wss:// WebSocket URL.
-# set(pn_ssl_impl src/ssl/openssl.c)
-# set(SSL_LIB ${OPENSSL_LIBRARIES})
-set(pn_ssl_impl ${PN_PATH}/src/ssl/ssl_stub.c)
-
-# emscripten is Linux like so use the posix impls.
-set(pn_io_impl ${PN_PATH}/src/posix/io.c)
-set(pn_selector_impl ${PN_PATH}/src/posix/selector.c)
-
-CHECK_LIBRARY_EXISTS (uuid uuid_generate "" UUID_GENERATE_IN_UUID)
-if (UUID_GENERATE_IN_UUID)
- set (UUID_LIB uuid)
-endif (UUID_GENERATE_IN_UUID)
-
-# Generate encodings.h and protocol.h
-# It may be possible to use the ones generated for the main proton-c build but
-# qpid-proton-core has a dependency on the generated files, so I'm not sure if
-# it'll work without a command that can be run as a dependency. Probably best
-# do it this way when cross-compiling - though more copy'n'paste
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/encodings.h
- COMMAND python ${PN_PATH}/env.py PYTHONPATH=${PN_PATH} python ${PN_PATH}/src/codec/encodings.h.py > ${CMAKE_CURRENT_BINARY_DIR}/encodings.h
- DEPENDS ${PN_PATH}/src/codec/encodings.h.py
- )
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/protocol.h
- COMMAND python ${PN_PATH}/env.py PYTHONPATH=${PN_PATH} python ${PN_PATH}/src/protocol.h.py > ${CMAKE_CURRENT_BINARY_DIR}/protocol.h
- DEPENDS ${PN_PATH}/src/protocol.h.py
- )
-
-set(COMPILE_WARNING_FLAGS "-Werror -Wall -pedantic-errors -Wno-comment -Wno-warn-absolute-paths")
-
-# Explicitly set PLATFORM_DEFINITIONS to Linux ones for emscripten as we don't
-# want to inadvertently use Windows versions if we happen to be cross-compiling
-# from a Windows platform
-set(PLATFORM_DEFINITIONS "USE_CLOCK_GETTIME;USE_UUID_GENERATE;USE_STRERROR_R;USE_ATOLL")
-
-# The following is largely a copy from the the main proton-c/CMakeLists.txt.
-# The main difference is prefixing paths with ${PN_PATH}/ as we can't use a
-# relative path from this CMakeLists.txt.
-
-set(qpid-proton-platform
- ${pn_io_impl}
- ${pn_selector_impl}
- ${PN_PATH}/src/platform.c
- ${pn_ssl_impl}
- )
-
-set(qpid-proton-core
- ${PN_PATH}/src/object/object.c
- ${PN_PATH}/src/object/list.c
- ${PN_PATH}/src/object/map.c
- ${PN_PATH}/src/object/string.c
- ${PN_PATH}/src/object/iterator.c
- ${PN_PATH}/src/object/record.c
-
- ${PN_PATH}/src/log.c
- ${PN_PATH}/src/util.c
- ${PN_PATH}/src/url.c
- ${PN_PATH}/src/error.c
- ${PN_PATH}/src/buffer.c
- ${PN_PATH}/src/parser.c
- ${PN_PATH}/src/scanner.c
- ${PN_PATH}/src/types.c
-
- ${PN_PATH}/src/framing/framing.c
-
- ${PN_PATH}/src/codec/codec.c
- ${PN_PATH}/src/codec/decoder.c
- ${PN_PATH}/src/codec/encoder.c
-
- ${PN_PATH}/src/dispatcher/dispatcher.c
- ${PN_PATH}/src/engine/engine.c
- ${PN_PATH}/src/events/event.c
- ${PN_PATH}/src/transport/autodetect.c
- ${PN_PATH}/src/transport/transport.c
- ${PN_PATH}/src/message/message.c
- ${PN_PATH}/src/sasl/sasl.c
- ${PN_PATH}/src/sasl/none_sasl.c
-
- ${PN_PATH}/src/messenger/messenger.c
- ${PN_PATH}/src/messenger/subscription.c
- ${PN_PATH}/src/messenger/store.c
- ${PN_PATH}/src/messenger/transform.c
- ${PN_PATH}/src/selectable.c
-
- ${CMAKE_CURRENT_BINARY_DIR}/encodings.h
- ${CMAKE_CURRENT_BINARY_DIR}/protocol.h
- )
-
-set_source_files_properties(
- ${qpid-proton-core}
- PROPERTIES
- COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS}"
- )
-
-set_source_files_properties(
- ${qpid-proton-platform}
- PROPERTIES
- COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}"
- COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
- )
-
-# Compile Proton into LLVM bitcode which will be used later in the linking stage
-# of add_executable for compilation into Javascript.
-add_library(
- qpid-proton-bitcode SHARED
-
- ${qpid-proton-core}
- ${qpid-proton-platform}
- )
-
-set_target_properties(
- qpid-proton-bitcode
- PROPERTIES
- VERSION "${PN_LIB_SOMAJOR}.${PN_LIB_SOMINOR}"
- SOVERSION "${PN_LIB_SOMAJOR}"
- LINK_FLAGS "${CATCH_UNDEFINED}"
- )
-target_link_libraries(qpid-proton-bitcode)
-
-
-# Compile the send-async.c and recv-async.c examples into JavaScript
-include_directories(${Proton_SOURCE_DIR}/examples/c/include)
-add_executable(send-async.js ${Proton_SOURCE_DIR}/examples/c/messenger/send-async.c)
-target_link_libraries(send-async.js qpid-proton-bitcode)
-
-add_executable(recv-async.js ${Proton_SOURCE_DIR}/examples/c/messenger/recv-async.c)
-target_link_libraries(recv-async.js qpid-proton-bitcode)
-
-set_target_properties(
- send-async.js recv-async.js
- PROPERTIES
- COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}"
- RUNTIME_OUTPUT_DIRECTORY examples
- DEPENDS ws
-
- LINK_FLAGS "-s \"WEBSOCKET_SUBPROTOCOL='AMQPWSB10'\" -${EMSCRIPTEN_LINK_OPTIMISATIONS}"
- )
-
-# Build the main JavaScript library called proton-messenger.js
-add_executable(proton-messenger.js binding.c)
-target_link_libraries(proton-messenger.js qpid-proton-bitcode ${UUID_LIB})
-
-set_target_properties(
- proton-messenger.js
- PROPERTIES
- COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}"
-
- # The --memory-init-file 0 stops emscripten emitting a separate memory
- # initialization file, if this was enabled it makes packaging harder as
- # applications would expect proton-messenger.js.mem to be served too. It's even
- # more fiddly with node.js packages. This behaviour might be reinstated if the
- # packaging mechanism improves.
-
- LINK_FLAGS "-s \"EXPORT_NAME='proton'\" -s \"WEBSOCKET_SUBPROTOCOL='AMQPWSB10'\" ${EMSCRIPTEN_LINK_OPTIMISATIONS} --memory-init-file 0 --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-open.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/module.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/error.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/messenger.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/subscription.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/message.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-uuid.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-symbol.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-described.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-array.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-typed-number.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-long.js --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/data-binary.js --post-js ${CMAKE_CURRENT_SOURCE_DIR}/binding-close.js -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"[]\" -s EXPORTED_FUNCTIONS=\"['_pn_get_version_major', '_
pn_get_version_minor', '_pn_uuid_generate', '_pn_bytes', '_pn_error_text', '_pn_code', '_pn_messenger', '_pn_messenger_name', '_pn_messenger_set_blocking', '_pn_messenger_free', '_pn_messenger_errno', '_pn_messenger_error', '_pn_messenger_get_outgoing_window', '_pn_messenger_set_outgoing_window', '_pn_messenger_get_incoming_window', '_pn_messenger_set_incoming_window', '_pn_messenger_start', '_pn_messenger_stop', '_pn_messenger_stopped', '_pn_messenger_subscribe', '_pn_messenger_put', '_pn_messenger_status', '_pn_messenger_buffered', '_pn_messenger_settle', '_pn_messenger_outgoing_tracker', '_pn_messenger_recv', '_pn_messenger_receiving', '_pn_messenger_get', '_pn_messenger_incoming_tracker', '_pn_messenger_incoming_subscription', '_pn_messenger_accept', '_pn_messenger_reject', '_pn_messenger_outgoing', '_pn_messenger_incoming', '_pn_messenger_route', '_pn_messenger_rewrite', '_pn_messenger_set_passive', '_pn_messenger_selectable', '_pn_subscription_get_context', '_pn_subscription_
set_context', '_pn_subscription_address', '_pn_message', '_pn_message_id', '_pn_message_correlation_id', '_pn_message_free', '_pn_message_errno', '_pn_message_error', '_pn_message_clear', '_pn_message_is_inferred', '_pn_message_set_inferred', '_pn_message_is_durable', '_pn_message_set_durable', '_pn_message_get_priority', '_pn_message_set_priority', '_pn_message_get_ttl', '_pn_message_set_ttl', '_pn_message_is_first_acquirer', '_pn_message_set_first_acquirer', '_pn_message_get_delivery_count', '_pn_message_set_delivery_count', '_pn_message_get_user_id', '_pn_message_set_user_id', '_pn_message_get_address', '_pn_message_set_address', '_pn_message_get_subject', '_pn_message_set_subject', '_pn_message_get_reply_to', '_pn_message_set_reply_to', '_pn_message_get_content_type', '_pn_message_set_content_type', '_pn_message_get_content_encoding', '_pn_message_set_content_encoding', '_pn_message_get_expiry_time', '_pn_message_set_expiry_time', '_pn_message_get_creation_time', '_pn_message_se
t_creation_time', '_pn_message_get_group_id', '_pn_message_set_group_id', '_pn_message_get_group_sequence', '_pn_message_set_group_sequence', '_pn_message_get_reply_to_group_id', '_pn_message_set_reply_to_group_id', '_pn_message_encode', '_pn_message_decode', '_pn_message_instructions', '_pn_message_annotations', '_pn_message_properties', '_pn_message_body', '_pn_data', '_pn_data_free', '_pn_data_error', '_pn_data_errno', '_pn_data_clear', '_pn_data_rewind', '_pn_data_next', '_pn_data_prev', '_pn_data_enter', '_pn_data_exit', '_pn_data_lookup', '_pn_data_narrow', '_pn_data_widen', '_pn_data_type', '_pn_data_encode', '_pn_data_decode', '_pn_data_put_list', '_pn_data_put_map', '_pn_data_put_array', '_pn_data_put_described', '_pn_data_put_null', '_pn_data_put_bool', '_pn_data_put_ubyte', '_pn_data_put_byte', '_pn_data_put_ushort', '_pn_data_put_short', '_pn_data_put_uint', '_pn_data_put_int', '_pn_data_put_char', '_pn_data_put_ulong', '_pn_data_put_long', '_pn_data_put_timestamp', '_pn
_data_put_float', '_pn_data_put_double', '_pn_data_put_decimal32', '_pn_data_put_decimal64', '_pn_data_put_decimal128', '_pn_data_put_uuid', '_pn_data_put_binary', '_pn_data_put_string', '_pn_data_put_symbol', '_pn_data_get_list', '_pn_data_get_map', '_pn_data_get_array', '_pn_data_is_array_described', '_pn_data_get_array_type', '_pn_data_is_described', '_pn_data_is_null', '_pn_data_get_bool', '_pn_data_get_ubyte', '_pn_data_get_byte', '_pn_data_get_ushort', '_pn_data_get_short', '_pn_data_get_uint', '_pn_data_get_int', '_pn_data_get_char', '_pn_data_get_ulong', '_pn_data_get_long', '_pn_data_get_timestamp', '_pn_data_get_float', '_pn_data_get_double', '_pn_data_get_decimal32', '_pn_data_get_decimal64', '_pn_data_get_decimal128', '_pn_data_get_uuid', '_pn_data_get_binary', '_pn_data_get_string', '_pn_data_get_symbol', '_pn_data_copy', '_pn_data_format', '_pn_data_dump', '_pn_selectable_readable', '_pn_selectable_is_reading', '_pn_selectable_writable', '_pn_selectable_is_writing', '_
pn_selectable_is_terminal', '_pn_selectable_get_fd', '_pn_selectable_free']\""
- )
-
-# This command packages up the compiled proton-messenger.js into a node.js package
-# called qpid-proton-messenger and copies it to the <proton>/node_modules directory.
-# This allows the node.js test and example programs to do:
-# var proton = require("qpid-proton-messenger");
-add_custom_command(
- TARGET proton-messenger.js
- COMMAND ${CMAKE_COMMAND}
- -E copy_directory
- ${CMAKE_CURRENT_SOURCE_DIR}/qpid-proton-messenger
- ${PROJECT_SOURCE_DIR}/node_modules/qpid-proton-messenger
- COMMAND ${CMAKE_COMMAND}
- -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/proton-messenger.js
- ${PROJECT_SOURCE_DIR}/node_modules/qpid-proton-messenger/lib
- COMMENT "Building qpid-proton-messenger package for node.js"
-)
-
-# The cleanall target removes the qpid-proton-messenger package from <proton>/node_modules
-add_custom_target(
- cleanall
- COMMAND echo "CLEAN NODE MODULES"
- COMMAND ${CMAKE_COMMAND}
- -E remove_directory
- ${PROJECT_SOURCE_DIR}/node_modules/qpid-proton-messenger
-)
-
-# If the docs target is specified and the jsdoc3 package for node.js has been
-# installed then build the JavaScript API documentation.
-if (NODE_JSDOC_FOUND)
- set(JSDOC_EXE ${PROJECT_SOURCE_DIR}/node_modules/.bin/jsdoc)
-
- message(STATUS "Documentation Enabled. Using ${JSDOC_EXE} to build JavaScript docs")
- add_custom_target(docs-js COMMAND ${JSDOC_EXE}
- -d ${CMAKE_CURRENT_BINARY_DIR}/html
- ${CMAKE_CURRENT_SOURCE_DIR}/module.js
- ${CMAKE_CURRENT_SOURCE_DIR}/error.js
- ${CMAKE_CURRENT_SOURCE_DIR}/messenger.js
- ${CMAKE_CURRENT_SOURCE_DIR}/subscription.js
- ${CMAKE_CURRENT_SOURCE_DIR}/message.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data-uuid.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data-symbol.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data-described.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data-array.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data-typed-number.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data-long.js
- ${CMAKE_CURRENT_SOURCE_DIR}/data-binary.js)
- add_dependencies(docs docs-js)
-endif (NODE_JSDOC_FOUND)
-
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org