| 1 |
/* |
| 2 |
Licensed to the Apache Software Foundation (ASF) under one |
| 3 |
or more contributor license agreements. See the NOTICE file |
| 4 |
distributed with this work for additional information |
| 5 |
regarding copyright ownership. The ASF licenses this file |
| 6 |
to you under the Apache License, Version 2.0 (the |
| 7 |
"License"); you may not use this file except in compliance |
| 8 |
with the License. You may obtain a copy of the License at |
| 9 |
|
| 10 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
|
| 12 |
Unless required by applicable law or agreed to in writing, |
| 13 |
software distributed under the License is distributed on an |
| 14 |
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 |
KIND, either express or implied. See the License for the |
| 16 |
specific language governing permissions and limitations |
| 17 |
under the License. |
| 18 |
*/ |
| 19 |
|
| 20 |
// |
| 21 |
// NOTE: DO NOT EDIT. This file was generated by genwrap.go from the proton header files. |
| 22 |
// Update the generator and re-run if you need to modify this code. |
| 23 |
// |
| 24 |
|
| 25 |
package proton |
| 26 |
|
| 27 |
import ( |
| 28 |
"time" |
| 29 |
"unsafe" |
| 30 |
) |
| 31 |
|
| 32 |
// #include <proton/condition.h> |
| 33 |
// #include <proton/error.h> |
| 34 |
// #include <proton/event.h> |
| 35 |
// #include <proton/types.h> |
| 36 |
// #include <stdlib.h> |
| 37 |
import "C" |
| 38 |
|
| 39 |
// #include <proton/session.h> |
| 40 |
// #include <proton/link.h> |
| 41 |
// #include <proton/delivery.h> |
| 42 |
// #include <proton/disposition.h> |
| 43 |
// #include <proton/condition.h> |
| 44 |
// #include <proton/terminus.h> |
| 45 |
// #include <proton/connection.h> |
| 46 |
// #include <proton/transport.h> |
| 47 |
// #include <proton/sasl.h> |
| 48 |
import "C" |
| 49 |
|
| 50 |
type EventType int |
| 51 |
|
| 52 |
const ( |
| 53 |
EConnectionInit EventType = C.PN_CONNECTION_INIT |
| 54 |
EConnectionBound EventType = C.PN_CONNECTION_BOUND |
| 55 |
EConnectionUnbound EventType = C.PN_CONNECTION_UNBOUND |
| 56 |
EConnectionLocalOpen EventType = C.PN_CONNECTION_LOCAL_OPEN |
| 57 |
EConnectionRemoteOpen EventType = C.PN_CONNECTION_REMOTE_OPEN |
| 58 |
EConnectionLocalClose EventType = C.PN_CONNECTION_LOCAL_CLOSE |
| 59 |
EConnectionRemoteClose EventType = C.PN_CONNECTION_REMOTE_CLOSE |
| 60 |
EConnectionFinal EventType = C.PN_CONNECTION_FINAL |
| 61 |
ESessionInit EventType = C.PN_SESSION_INIT |
| 62 |
ESessionLocalOpen EventType = C.PN_SESSION_LOCAL_OPEN |
| 63 |
ESessionRemoteOpen EventType = C.PN_SESSION_REMOTE_OPEN |
| 64 |
ESessionLocalClose EventType = C.PN_SESSION_LOCAL_CLOSE |
| 65 |
ESessionRemoteClose EventType = C.PN_SESSION_REMOTE_CLOSE |
| 66 |
ESessionFinal EventType = C.PN_SESSION_FINAL |
| 67 |
ELinkInit EventType = C.PN_LINK_INIT |
| 68 |
ELinkLocalOpen EventType = C.PN_LINK_LOCAL_OPEN |
| 69 |
ELinkRemoteOpen EventType = C.PN_LINK_REMOTE_OPEN |
| 70 |
ELinkLocalClose EventType = C.PN_LINK_LOCAL_CLOSE |
| 71 |
ELinkRemoteClose EventType = C.PN_LINK_REMOTE_CLOSE |
| 72 |
ELinkLocalDetach EventType = C.PN_LINK_LOCAL_DETACH |
| 73 |
ELinkRemoteDetach EventType = C.PN_LINK_REMOTE_DETACH |
| 74 |
ELinkFlow EventType = C.PN_LINK_FLOW |
| 75 |
ELinkFinal EventType = C.PN_LINK_FINAL |
| 76 |
EDelivery EventType = C.PN_DELIVERY |
| 77 |
ETransport EventType = C.PN_TRANSPORT |
| 78 |
ETransportAuthenticated EventType = C.PN_TRANSPORT_AUTHENTICATED |
| 79 |
ETransportError EventType = C.PN_TRANSPORT_ERROR |
| 80 |
ETransportHeadClosed EventType = C.PN_TRANSPORT_HEAD_CLOSED |
| 81 |
ETransportTailClosed EventType = C.PN_TRANSPORT_TAIL_CLOSED |
| 82 |
ETransportClosed EventType = C.PN_TRANSPORT_CLOSED |
| 83 |
EConnectionWake EventType = C.PN_CONNECTION_WAKE |
| 84 |
EListenerAccept EventType = C.PN_LISTENER_ACCEPT |
| 85 |
EListenerClose EventType = C.PN_LISTENER_CLOSE |
| 86 |
EProactorInterrupt EventType = C.PN_PROACTOR_INTERRUPT |
| 87 |
EProactorTimeout EventType = C.PN_PROACTOR_TIMEOUT |
| 88 |
EProactorInactive EventType = C.PN_PROACTOR_INACTIVE |
| 89 |
EListenerOpen EventType = C.PN_LISTENER_OPEN |
| 90 |
) |
| 91 |
|
| 92 |
func (e EventType) String() string { |
| 93 |
switch e { |
| 94 |
|
| 95 |
case C.PN_CONNECTION_INIT: |
| 96 |
return "ConnectionInit" |
| 97 |
case C.PN_CONNECTION_BOUND: |
| 98 |
return "ConnectionBound" |
| 99 |
case C.PN_CONNECTION_UNBOUND: |
| 100 |
return "ConnectionUnbound" |
| 101 |
case C.PN_CONNECTION_LOCAL_OPEN: |
| 102 |
return "ConnectionLocalOpen" |
| 103 |
case C.PN_CONNECTION_REMOTE_OPEN: |
| 104 |
return "ConnectionRemoteOpen" |
| 105 |
case C.PN_CONNECTION_LOCAL_CLOSE: |
| 106 |
return "ConnectionLocalClose" |
| 107 |
case C.PN_CONNECTION_REMOTE_CLOSE: |
| 108 |
return "ConnectionRemoteClose" |
| 109 |
case C.PN_CONNECTION_FINAL: |
| 110 |
return "ConnectionFinal" |
| 111 |
case C.PN_SESSION_INIT: |
| 112 |
return "SessionInit" |
| 113 |
case C.PN_SESSION_LOCAL_OPEN: |
| 114 |
return "SessionLocalOpen" |
| 115 |
case C.PN_SESSION_REMOTE_OPEN: |
| 116 |
return "SessionRemoteOpen" |
| 117 |
case C.PN_SESSION_LOCAL_CLOSE: |
| 118 |
return "SessionLocalClose" |
| 119 |
case C.PN_SESSION_REMOTE_CLOSE: |
| 120 |
return "SessionRemoteClose" |
| 121 |
case C.PN_SESSION_FINAL: |
| 122 |
return "SessionFinal" |
| 123 |
case C.PN_LINK_INIT: |
| 124 |
return "LinkInit" |
| 125 |
case C.PN_LINK_LOCAL_OPEN: |
| 126 |
return "LinkLocalOpen" |
| 127 |
case C.PN_LINK_REMOTE_OPEN: |
| 128 |
return "LinkRemoteOpen" |
| 129 |
case C.PN_LINK_LOCAL_CLOSE: |
| 130 |
return "LinkLocalClose" |
| 131 |
case C.PN_LINK_REMOTE_CLOSE: |
| 132 |
return "LinkRemoteClose" |
| 133 |
case C.PN_LINK_LOCAL_DETACH: |
| 134 |
return "LinkLocalDetach" |
| 135 |
case C.PN_LINK_REMOTE_DETACH: |
| 136 |
return "LinkRemoteDetach" |
| 137 |
case C.PN_LINK_FLOW: |
| 138 |
return "LinkFlow" |
| 139 |
case C.PN_LINK_FINAL: |
| 140 |
return "LinkFinal" |
| 141 |
case C.PN_DELIVERY: |
| 142 |
return "Delivery" |
| 143 |
case C.PN_TRANSPORT: |
| 144 |
return "Transport" |
| 145 |
case C.PN_TRANSPORT_AUTHENTICATED: |
| 146 |
return "TransportAuthenticated" |
| 147 |
case C.PN_TRANSPORT_ERROR: |
| 148 |
return "TransportError" |
| 149 |
case C.PN_TRANSPORT_HEAD_CLOSED: |
| 150 |
return "TransportHeadClosed" |
| 151 |
case C.PN_TRANSPORT_TAIL_CLOSED: |
| 152 |
return "TransportTailClosed" |
| 153 |
case C.PN_TRANSPORT_CLOSED: |
| 154 |
return "TransportClosed" |
| 155 |
case C.PN_CONNECTION_WAKE: |
| 156 |
return "ConnectionWake" |
| 157 |
case C.PN_LISTENER_ACCEPT: |
| 158 |
return "ListenerAccept" |
| 159 |
case C.PN_LISTENER_CLOSE: |
| 160 |
return "ListenerClose" |
| 161 |
case C.PN_PROACTOR_INTERRUPT: |
| 162 |
return "ProactorInterrupt" |
| 163 |
case C.PN_PROACTOR_TIMEOUT: |
| 164 |
return "ProactorTimeout" |
| 165 |
case C.PN_PROACTOR_INACTIVE: |
| 166 |
return "ProactorInactive" |
| 167 |
case C.PN_LISTENER_OPEN: |
| 168 |
return "ListenerOpen" |
| 169 |
} |
| 170 |
return "Unknown" |
| 171 |
} |
| 172 |
|
| 173 |
// Wrappers for declarations in session.h |
| 174 |
|
| 175 |
type Session struct{ pn *C.pn_session_t } |
| 176 |
|
| 177 |
func (s Session) IsNil() bool { return s.pn == nil } |
| 178 |
func (s Session) CPtr() unsafe.Pointer { return unsafe.Pointer(s.pn) } |
| 179 |
func (s Session) Free() { |
| 180 |
C.pn_session_free(s.pn) |
| 181 |
} |
| 182 |
func (s Session) State() State { |
| 183 |
return State(C.pn_session_state(s.pn)) |
| 184 |
} |
| 185 |
func (s Session) Error() error { |
| 186 |
return PnError(C.pn_session_error(s.pn)) |
| 187 |
} |
| 188 |
func (s Session) Condition() Condition { |
| 189 |
return Condition{C.pn_session_condition(s.pn)} |
| 190 |
} |
| 191 |
func (s Session) RemoteCondition() Condition { |
| 192 |
return Condition{C.pn_session_remote_condition(s.pn)} |
| 193 |
} |
| 194 |
func (s Session) Connection() Connection { |
| 195 |
return Connection{C.pn_session_connection(s.pn)} |
| 196 |
} |
| 197 |
func (s Session) Open() { |
| 198 |
C.pn_session_open(s.pn) |
| 199 |
} |
| 200 |
func (s Session) Close() { |
| 201 |
C.pn_session_close(s.pn) |
| 202 |
} |
| 203 |
func (s Session) IncomingCapacity() uint { |
| 204 |
return uint(C.pn_session_get_incoming_capacity(s.pn)) |
| 205 |
} |
| 206 |
func (s Session) SetIncomingCapacity(capacity uint) { |
| 207 |
C.pn_session_set_incoming_capacity(s.pn, C.size_t(capacity)) |
| 208 |
} |
| 209 |
func (s Session) OutgoingWindow() uint { |
| 210 |
return uint(C.pn_session_get_outgoing_window(s.pn)) |
| 211 |
} |
| 212 |
func (s Session) SetOutgoingWindow(window uint) { |
| 213 |
C.pn_session_set_outgoing_window(s.pn, C.size_t(window)) |
| 214 |
} |
| 215 |
func (s Session) OutgoingBytes() uint { |
| 216 |
return uint(C.pn_session_outgoing_bytes(s.pn)) |
| 217 |
} |
| 218 |
func (s Session) IncomingBytes() uint { |
| 219 |
return uint(C.pn_session_incoming_bytes(s.pn)) |
| 220 |
} |
| 221 |
func (s Session) Next(state State) Session { |
| 222 |
return Session{C.pn_session_next(s.pn, C.pn_state_t(state))} |
| 223 |
} |
| 224 |
|
| 225 |
// Wrappers for declarations in link.h |
| 226 |
|
| 227 |
type SndSettleMode C.pn_snd_settle_mode_t |
| 228 |
|
| 229 |
const ( |
| 230 |
SndUnsettled SndSettleMode = C.PN_SND_UNSETTLED |
| 231 |
SndSettled SndSettleMode = C.PN_SND_SETTLED |
| 232 |
SndMixed SndSettleMode = C.PN_SND_MIXED |
| 233 |
) |
| 234 |
|
| 235 |
func (e SndSettleMode) String() string { |
| 236 |
switch e { |
| 237 |
|
| 238 |
case C.PN_SND_UNSETTLED: |
| 239 |
return "SndUnsettled" |
| 240 |
case C.PN_SND_SETTLED: |
| 241 |
return "SndSettled" |
| 242 |
case C.PN_SND_MIXED: |
| 243 |
return "SndMixed" |
| 244 |
} |
| 245 |
return "unknown" |
| 246 |
} |
| 247 |
|
| 248 |
type RcvSettleMode C.pn_rcv_settle_mode_t |
| 249 |
|
| 250 |
const ( |
| 251 |
RcvFirst RcvSettleMode = C.PN_RCV_FIRST |
| 252 |
RcvSecond RcvSettleMode = C.PN_RCV_SECOND |
| 253 |
) |
| 254 |
|
| 255 |
func (e RcvSettleMode) String() string { |
| 256 |
switch e { |
| 257 |
|
| 258 |
case C.PN_RCV_FIRST: |
| 259 |
return "RcvFirst" |
| 260 |
case C.PN_RCV_SECOND: |
| 261 |
return "RcvSecond" |
| 262 |
} |
| 263 |
return "unknown" |
| 264 |
} |
| 265 |
|
| 266 |
type Link struct{ pn *C.pn_link_t } |
| 267 |
|
| 268 |
func (l Link) IsNil() bool { return l.pn == nil } |
| 269 |
func (l Link) CPtr() unsafe.Pointer { return unsafe.Pointer(l.pn) } |
| 270 |
func (l Link) Free() { |
| 271 |
C.pn_link_free(l.pn) |
| 272 |
} |
| 273 |
func (l Link) Name() string { |
| 274 |
return C.GoString(C.pn_link_name(l.pn)) |
| 275 |
} |
| 276 |
func (l Link) IsSender() bool { |
| 277 |
return bool(C.pn_link_is_sender(l.pn)) |
| 278 |
} |
| 279 |
func (l Link) IsReceiver() bool { |
| 280 |
return bool(C.pn_link_is_receiver(l.pn)) |
| 281 |
} |
| 282 |
func (l Link) State() State { |
| 283 |
return State(C.pn_link_state(l.pn)) |
| 284 |
} |
| 285 |
func (l Link) Error() error { |
| 286 |
return PnError(C.pn_link_error(l.pn)) |
| 287 |
} |
| 288 |
func (l Link) Condition() Condition { |
| 289 |
return Condition{C.pn_link_condition(l.pn)} |
| 290 |
} |
| 291 |
func (l Link) RemoteCondition() Condition { |
| 292 |
return Condition{C.pn_link_remote_condition(l.pn)} |
| 293 |
} |
| 294 |
func (l Link) Session() Session { |
| 295 |
return Session{C.pn_link_session(l.pn)} |
| 296 |
} |
| 297 |
func (l Link) Next(state State) Link { |
| 298 |
return Link{C.pn_link_next(l.pn, C.pn_state_t(state))} |
| 299 |
} |
| 300 |
func (l Link) Open() { |
| 301 |
C.pn_link_open(l.pn) |
| 302 |
} |
| 303 |
func (l Link) Close() { |
| 304 |
C.pn_link_close(l.pn) |
| 305 |
} |
| 306 |
func (l Link) Detach() { |
| 307 |
C.pn_link_detach(l.pn) |
| 308 |
} |
| 309 |
func (l Link) Source() Terminus { |
| 310 |
return Terminus{C.pn_link_source(l.pn)} |
| 311 |
} |
| 312 |
func (l Link) Target() Terminus { |
| 313 |
return Terminus{C.pn_link_target(l.pn)} |
| 314 |
} |
| 315 |
func (l Link) RemoteSource() Terminus { |
| 316 |
return Terminus{C.pn_link_remote_source(l.pn)} |
| 317 |
} |
| 318 |
func (l Link) RemoteTarget() Terminus { |
| 319 |
return Terminus{C.pn_link_remote_target(l.pn)} |
| 320 |
} |
| 321 |
func (l Link) Current() Delivery { |
| 322 |
return Delivery{C.pn_link_current(l.pn)} |
| 323 |
} |
| 324 |
func (l Link) Advance() bool { |
| 325 |
return bool(C.pn_link_advance(l.pn)) |
| 326 |
} |
| 327 |
func (l Link) Credit() int { |
| 328 |
return int(C.pn_link_credit(l.pn)) |
| 329 |
} |
| 330 |
func (l Link) Queued() int { |
| 331 |
return int(C.pn_link_queued(l.pn)) |
| 332 |
} |
| 333 |
func (l Link) RemoteCredit() int { |
| 334 |
return int(C.pn_link_remote_credit(l.pn)) |
| 335 |
} |
| 336 |
func (l Link) Drained() int { |
| 337 |
return int(C.pn_link_drained(l.pn)) |
| 338 |
} |
| 339 |
func (l Link) Available() int { |
| 340 |
return int(C.pn_link_available(l.pn)) |
| 341 |
} |
| 342 |
func (l Link) SndSettleMode() SndSettleMode { |
| 343 |
return SndSettleMode(C.pn_link_snd_settle_mode(l.pn)) |
| 344 |
} |
| 345 |
func (l Link) RcvSettleMode() RcvSettleMode { |
| 346 |
return RcvSettleMode(C.pn_link_rcv_settle_mode(l.pn)) |
| 347 |
} |
| 348 |
func (l Link) SetSndSettleMode(mode SndSettleMode) { |
| 349 |
C.pn_link_set_snd_settle_mode(l.pn, C.pn_snd_settle_mode_t(mode)) |
| 350 |
} |
| 351 |
func (l Link) SetRcvSettleMode(mode RcvSettleMode) { |
| 352 |
C.pn_link_set_rcv_settle_mode(l.pn, C.pn_rcv_settle_mode_t(mode)) |
| 353 |
} |
| 354 |
func (l Link) RemoteSndSettleMode() SndSettleMode { |
| 355 |
return SndSettleMode(C.pn_link_remote_snd_settle_mode(l.pn)) |
| 356 |
} |
| 357 |
func (l Link) RemoteRcvSettleMode() RcvSettleMode { |
| 358 |
return RcvSettleMode(C.pn_link_remote_rcv_settle_mode(l.pn)) |
| 359 |
} |
| 360 |
func (l Link) Unsettled() int { |
| 361 |
return int(C.pn_link_unsettled(l.pn)) |
| 362 |
} |
| 363 |
func (l Link) Offered(credit int) { |
| 364 |
C.pn_link_offered(l.pn, C.int(credit)) |
| 365 |
} |
| 366 |
func (l Link) Flow(credit int) { |
| 367 |
C.pn_link_flow(l.pn, C.int(credit)) |
| 368 |
} |
| 369 |
func (l Link) Drain(credit int) { |
| 370 |
C.pn_link_drain(l.pn, C.int(credit)) |
| 371 |
} |
| 372 |
func (l Link) SetDrain(drain bool) { |
| 373 |
C.pn_link_set_drain(l.pn, C.bool(drain)) |
| 374 |
} |
| 375 |
func (l Link) Draining() bool { |
| 376 |
return bool(C.pn_link_draining(l.pn)) |
| 377 |
} |
| 378 |
func (l Link) MaxMessageSize() uint64 { |
| 379 |
return uint64(C.pn_link_max_message_size(l.pn)) |
| 380 |
} |
| 381 |
func (l Link) SetMaxMessageSize(size uint64) { |
| 382 |
C.pn_link_set_max_message_size(l.pn, C.uint64_t(size)) |
| 383 |
} |
| 384 |
func (l Link) RemoteMaxMessageSize() uint64 { |
| 385 |
return uint64(C.pn_link_remote_max_message_size(l.pn)) |
| 386 |
} |
| 387 |
|
| 388 |
// Wrappers for declarations in delivery.h |
| 389 |
|
| 390 |
type Delivery struct{ pn *C.pn_delivery_t } |
| 391 |
|
| 392 |
func (d Delivery) IsNil() bool { return d.pn == nil } |
| 393 |
func (d Delivery) CPtr() unsafe.Pointer { return unsafe.Pointer(d.pn) } |
| 394 |
func (d Delivery) Tag() DeliveryTag { |
| 395 |
return DeliveryTag{C.pn_delivery_tag(d.pn)} |
| 396 |
} |
| 397 |
func (d Delivery) Link() Link { |
| 398 |
return Link{C.pn_delivery_link(d.pn)} |
| 399 |
} |
| 400 |
func (d Delivery) Local() Disposition { |
| 401 |
return Disposition{C.pn_delivery_local(d.pn)} |
| 402 |
} |
| 403 |
func (d Delivery) LocalState() uint64 { |
| 404 |
return uint64(C.pn_delivery_local_state(d.pn)) |
| 405 |
} |
| 406 |
func (d Delivery) Remote() Disposition { |
| 407 |
return Disposition{C.pn_delivery_remote(d.pn)} |
| 408 |
} |
| 409 |
func (d Delivery) RemoteState() uint64 { |
| 410 |
return uint64(C.pn_delivery_remote_state(d.pn)) |
| 411 |
} |
| 412 |
func (d Delivery) Settled() bool { |
| 413 |
return bool(C.pn_delivery_settled(d.pn)) |
| 414 |
} |
| 415 |
func (d Delivery) Pending() uint { |
| 416 |
return uint(C.pn_delivery_pending(d.pn)) |
| 417 |
} |
| 418 |
func (d Delivery) Partial() bool { |
| 419 |
return bool(C.pn_delivery_partial(d.pn)) |
| 420 |
} |
| 421 |
func (d Delivery) Aborted() bool { |
| 422 |
return bool(C.pn_delivery_aborted(d.pn)) |
| 423 |
} |
| 424 |
func (d Delivery) Writable() bool { |
| 425 |
return bool(C.pn_delivery_writable(d.pn)) |
| 426 |
} |
| 427 |
func (d Delivery) Readable() bool { |
| 428 |
return bool(C.pn_delivery_readable(d.pn)) |
| 429 |
} |
| 430 |
func (d Delivery) Updated() bool { |
| 431 |
return bool(C.pn_delivery_updated(d.pn)) |
| 432 |
} |
| 433 |
func (d Delivery) Update(state uint64) { |
| 434 |
C.pn_delivery_update(d.pn, C.uint64_t(state)) |
| 435 |
} |
| 436 |
func (d Delivery) Clear() { |
| 437 |
C.pn_delivery_clear(d.pn) |
| 438 |
} |
| 439 |
func (d Delivery) Current() bool { |
| 440 |
return bool(C.pn_delivery_current(d.pn)) |
| 441 |
} |
| 442 |
func (d Delivery) Abort() { |
| 443 |
C.pn_delivery_abort(d.pn) |
| 444 |
} |
| 445 |
func (d Delivery) Settle() { |
| 446 |
C.pn_delivery_settle(d.pn) |
| 447 |
} |
| 448 |
func (d Delivery) Dump() { |
| 449 |
C.pn_delivery_dump(d.pn) |
| 450 |
} |
| 451 |
func (d Delivery) Buffered() bool { |
| 452 |
return bool(C.pn_delivery_buffered(d.pn)) |
| 453 |
} |
| 454 |
|
| 455 |
// Wrappers for declarations in disposition.h |
| 456 |
|
| 457 |
type Disposition struct{ pn *C.pn_disposition_t } |
| 458 |
|
| 459 |
func (d Disposition) IsNil() bool { return d.pn == nil } |
| 460 |
func (d Disposition) CPtr() unsafe.Pointer { return unsafe.Pointer(d.pn) } |
| 461 |
func (d Disposition) Type() uint64 { |
| 462 |
return uint64(C.pn_disposition_type(d.pn)) |
| 463 |
} |
| 464 |
func (d Disposition) Condition() Condition { |
| 465 |
return Condition{C.pn_disposition_condition(d.pn)} |
| 466 |
} |
| 467 |
func (d Disposition) Data() Data { |
| 468 |
return Data{C.pn_disposition_data(d.pn)} |
| 469 |
} |
| 470 |
func (d Disposition) SectionNumber() uint16 { |
| 471 |
return uint16(C.pn_disposition_get_section_number(d.pn)) |
| 472 |
} |
| 473 |
func (d Disposition) SetSectionNumber(section_number uint16) { |
| 474 |
C.pn_disposition_set_section_number(d.pn, C.uint32_t(section_number)) |
| 475 |
} |
| 476 |
func (d Disposition) SectionOffset() uint64 { |
| 477 |
return uint64(C.pn_disposition_get_section_offset(d.pn)) |
| 478 |
} |
| 479 |
func (d Disposition) SetSectionOffset(section_offset uint64) { |
| 480 |
C.pn_disposition_set_section_offset(d.pn, C.uint64_t(section_offset)) |
| 481 |
} |
| 482 |
func (d Disposition) IsFailed() bool { |
| 483 |
return bool(C.pn_disposition_is_failed(d.pn)) |
| 484 |
} |
| 485 |
func (d Disposition) SetFailed(failed bool) { |
| 486 |
C.pn_disposition_set_failed(d.pn, C.bool(failed)) |
| 487 |
} |
| 488 |
func (d Disposition) IsUndeliverable() bool { |
| 489 |
return bool(C.pn_disposition_is_undeliverable(d.pn)) |
| 490 |
} |
| 491 |
func (d Disposition) SetUndeliverable(undeliverable bool) { |
| 492 |
C.pn_disposition_set_undeliverable(d.pn, C.bool(undeliverable)) |
| 493 |
} |
| 494 |
func (d Disposition) Annotations() Data { |
| 495 |
return Data{C.pn_disposition_annotations(d.pn)} |
| 496 |
} |
| 497 |
|
| 498 |
// Wrappers for declarations in condition.h |
| 499 |
|
| 500 |
type Condition struct{ pn *C.pn_condition_t } |
| 501 |
|
| 502 |
func (c Condition) IsNil() bool { return c.pn == nil } |
| 503 |
func (c Condition) CPtr() unsafe.Pointer { return unsafe.Pointer(c.pn) } |
| 504 |
func (c Condition) IsSet() bool { |
| 505 |
return bool(C.pn_condition_is_set(c.pn)) |
| 506 |
} |
| 507 |
func (c Condition) Clear() { |
| 508 |
C.pn_condition_clear(c.pn) |
| 509 |
} |
| 510 |
func (c Condition) Name() string { |
| 511 |
return C.GoString(C.pn_condition_get_name(c.pn)) |
| 512 |
} |
| 513 |
func (c Condition) SetName(name string) int { |
| 514 |
nameC := C.CString(name) |
| 515 |
defer C.free(unsafe.Pointer(nameC)) |
| 516 |
|
| 517 |
return int(C.pn_condition_set_name(c.pn, nameC)) |
| 518 |
} |
| 519 |
func (c Condition) Description() string { |
| 520 |
return C.GoString(C.pn_condition_get_description(c.pn)) |
| 521 |
} |
| 522 |
func (c Condition) SetDescription(description string) int { |
| 523 |
descriptionC := C.CString(description) |
| 524 |
defer C.free(unsafe.Pointer(descriptionC)) |
| 525 |
|
| 526 |
return int(C.pn_condition_set_description(c.pn, descriptionC)) |
| 527 |
} |
| 528 |
func (c Condition) Info() Data { |
| 529 |
return Data{C.pn_condition_info(c.pn)} |
| 530 |
} |
| 531 |
func (c Condition) IsRedirect() bool { |
| 532 |
return bool(C.pn_condition_is_redirect(c.pn)) |
| 533 |
} |
| 534 |
func (c Condition) RedirectHost() string { |
| 535 |
return C.GoString(C.pn_condition_redirect_host(c.pn)) |
| 536 |
} |
| 537 |
func (c Condition) RedirectPort() int { |
| 538 |
return int(C.pn_condition_redirect_port(c.pn)) |
| 539 |
} |
| 540 |
func (c Condition) Copy(src Condition) int { |
| 541 |
return int(C.pn_condition_copy(c.pn, src.pn)) |
| 542 |
} |
| 543 |
|
| 544 |
// Wrappers for declarations in terminus.h |
| 545 |
|
| 546 |
type TerminusType C.pn_terminus_type_t |
| 547 |
|
| 548 |
const ( |
| 549 |
Unspecified TerminusType = C.PN_UNSPECIFIED |
| 550 |
Source TerminusType = C.PN_SOURCE |
| 551 |
Target TerminusType = C.PN_TARGET |
| 552 |
Coordinator TerminusType = C.PN_COORDINATOR |
| 553 |
) |
| 554 |
|
| 555 |
func (e TerminusType) String() string { |
| 556 |
switch e { |
| 557 |
|
| 558 |
case C.PN_UNSPECIFIED: |
| 559 |
return "Unspecified" |
| 560 |
case C.PN_SOURCE: |
| 561 |
return "Source" |
| 562 |
case C.PN_TARGET: |
| 563 |
return "Target" |
| 564 |
case C.PN_COORDINATOR: |
| 565 |
return "Coordinator" |
| 566 |
} |
| 567 |
return "unknown" |
| 568 |
} |
| 569 |
|
| 570 |
type Durability C.pn_durability_t |
| 571 |
|
| 572 |
const ( |
| 573 |
Nondurable Durability = C.PN_NONDURABLE |
| 574 |
Configuration Durability = C.PN_CONFIGURATION |
| 575 |
Deliveries Durability = C.PN_DELIVERIES |
| 576 |
) |
| 577 |
|
| 578 |
func (e Durability) String() string { |
| 579 |
switch e { |
| 580 |
|
| 581 |
case C.PN_NONDURABLE: |
| 582 |
return "Nondurable" |
| 583 |
case C.PN_CONFIGURATION: |
| 584 |
return "Configuration" |
| 585 |
case C.PN_DELIVERIES: |
| 586 |
return "Deliveries" |
| 587 |
} |
| 588 |
return "unknown" |
| 589 |
} |
| 590 |
|
| 591 |
type ExpiryPolicy C.pn_expiry_policy_t |
| 592 |
|
| 593 |
const ( |
| 594 |
ExpireWithLink ExpiryPolicy = C.PN_EXPIRE_WITH_LINK |
| 595 |
ExpireWithSession ExpiryPolicy = C.PN_EXPIRE_WITH_SESSION |
| 596 |
ExpireWithConnection ExpiryPolicy = C.PN_EXPIRE_WITH_CONNECTION |
| 597 |
ExpireNever ExpiryPolicy = C.PN_EXPIRE_NEVER |
| 598 |
) |
| 599 |
|
| 600 |
func (e ExpiryPolicy) String() string { |
| 601 |
switch e { |
| 602 |
|
| 603 |
case C.PN_EXPIRE_WITH_LINK: |
| 604 |
return "ExpireWithLink" |
| 605 |
case C.PN_EXPIRE_WITH_SESSION: |
| 606 |
return "ExpireWithSession" |
| 607 |
case C.PN_EXPIRE_WITH_CONNECTION: |
| 608 |
return "ExpireWithConnection" |
| 609 |
case C.PN_EXPIRE_NEVER: |
| 610 |
return "ExpireNever" |
| 611 |
} |
| 612 |
return "unknown" |
| 613 |
} |
| 614 |
|
| 615 |
type DistributionMode C.pn_distribution_mode_t |
| 616 |
|
| 617 |
const ( |
| 618 |
DistModeUnspecified DistributionMode = C.PN_DIST_MODE_UNSPECIFIED |
| 619 |
DistModeCopy DistributionMode = C.PN_DIST_MODE_COPY |
| 620 |
DistModeMove DistributionMode = C.PN_DIST_MODE_MOVE |
| 621 |
) |
| 622 |
|
| 623 |
func (e DistributionMode) String() string { |
| 624 |
switch e { |
| 625 |
|
| 626 |
case C.PN_DIST_MODE_UNSPECIFIED: |
| 627 |
return "DistModeUnspecified" |
| 628 |
case C.PN_DIST_MODE_COPY: |
| 629 |
return "DistModeCopy" |
| 630 |
case C.PN_DIST_MODE_MOVE: |
| 631 |
return "DistModeMove" |
| 632 |
} |
| 633 |
return "unknown" |
| 634 |
} |
| 635 |
|
| 636 |
type Terminus struct{ pn *C.pn_terminus_t } |
| 637 |
|
| 638 |
func (t Terminus) IsNil() bool { return t.pn == nil } |
| 639 |
func (t Terminus) CPtr() unsafe.Pointer { return unsafe.Pointer(t.pn) } |
| 640 |
func (t Terminus) Type() TerminusType { |
| 641 |
return TerminusType(C.pn_terminus_get_type(t.pn)) |
| 642 |
} |
| 643 |
func (t Terminus) SetType(type_ TerminusType) int { |
| 644 |
return int(C.pn_terminus_set_type(t.pn, C.pn_terminus_type_t(type_))) |
| 645 |
} |
| 646 |
func (t Terminus) Address() string { |
| 647 |
return C.GoString(C.pn_terminus_get_address(t.pn)) |
| 648 |
} |
| 649 |
func (t Terminus) SetAddress(address string) int { |
| 650 |
addressC := C.CString(address) |
| 651 |
defer C.free(unsafe.Pointer(addressC)) |
| 652 |
|
| 653 |
return int(C.pn_terminus_set_address(t.pn, addressC)) |
| 654 |
} |
| 655 |
func (t Terminus) SetDistributionMode(mode DistributionMode) int { |
| 656 |
return int(C.pn_terminus_set_distribution_mode(t.pn, C.pn_distribution_mode_t(mode))) |
| 657 |
} |
| 658 |
func (t Terminus) Durability() Durability { |
| 659 |
return Durability(C.pn_terminus_get_durability(t.pn)) |
| 660 |
} |
| 661 |
func (t Terminus) SetDurability(durability Durability) int { |
| 662 |
return int(C.pn_terminus_set_durability(t.pn, C.pn_durability_t(durability))) |
| 663 |
} |
| 664 |
func (t Terminus) ExpiryPolicy() ExpiryPolicy { |
| 665 |
return ExpiryPolicy(C.pn_terminus_get_expiry_policy(t.pn)) |
| 666 |
} |
| 667 |
func (t Terminus) SetExpiryPolicy(policy ExpiryPolicy) int { |
| 668 |
return int(C.pn_terminus_set_expiry_policy(t.pn, C.pn_expiry_policy_t(policy))) |
| 669 |
} |
| 670 |
func (t Terminus) Timeout() time.Duration { |
| 671 |
return (time.Duration(C.pn_terminus_get_timeout(t.pn)) * time.Second) |
| 672 |
} |
| 673 |
func (t Terminus) SetTimeout(timeout time.Duration) int { |
| 674 |
return int(C.pn_terminus_set_timeout(t.pn, C.pn_seconds_t(timeout/time.Second))) |
| 675 |
} |
| 676 |
func (t Terminus) IsDynamic() bool { |
| 677 |
return bool(C.pn_terminus_is_dynamic(t.pn)) |
| 678 |
} |
| 679 |
func (t Terminus) SetDynamic(dynamic bool) int { |
| 680 |
return int(C.pn_terminus_set_dynamic(t.pn, C.bool(dynamic))) |
| 681 |
} |
| 682 |
func (t Terminus) Properties() Data { |
| 683 |
return Data{C.pn_terminus_properties(t.pn)} |
| 684 |
} |
| 685 |
func (t Terminus) Capabilities() Data { |
| 686 |
return Data{C.pn_terminus_capabilities(t.pn)} |
| 687 |
} |
| 688 |
func (t Terminus) Outcomes() Data { |
| 689 |
return Data{C.pn_terminus_outcomes(t.pn)} |
| 690 |
} |
| 691 |
func (t Terminus) Filter() Data { |
| 692 |
return Data{C.pn_terminus_filter(t.pn)} |
| 693 |
} |
| 694 |
func (t Terminus) Copy(src Terminus) int { |
| 695 |
return int(C.pn_terminus_copy(t.pn, src.pn)) |
| 696 |
} |
| 697 |
|
| 698 |
// Wrappers for declarations in connection.h |
| 699 |
|
| 700 |
type Connection struct{ pn *C.pn_connection_t } |
| 701 |
|
| 702 |
func (c Connection) IsNil() bool { return c.pn == nil } |
| 703 |
func (c Connection) CPtr() unsafe.Pointer { return unsafe.Pointer(c.pn) } |
| 704 |
func (c Connection) Free() { |
| 705 |
C.pn_connection_free(c.pn) |
| 706 |
} |
| 707 |
func (c Connection) Release() { |
| 708 |
C.pn_connection_release(c.pn) |
| 709 |
} |
| 710 |
func (c Connection) Error() error { |
| 711 |
return PnError(C.pn_connection_error(c.pn)) |
| 712 |
} |
| 713 |
func (c Connection) State() State { |
| 714 |
return State(C.pn_connection_state(c.pn)) |
| 715 |
} |
| 716 |
func (c Connection) Open() { |
| 717 |
C.pn_connection_open(c.pn) |
| 718 |
} |
| 719 |
func (c Connection) Close() { |
| 720 |
C.pn_connection_close(c.pn) |
| 721 |
} |
| 722 |
func (c Connection) Reset() { |
| 723 |
C.pn_connection_reset(c.pn) |
| 724 |
} |
| 725 |
func (c Connection) Condition() Condition { |
| 726 |
return Condition{C.pn_connection_condition(c.pn)} |
| 727 |
} |
| 728 |
func (c Connection) RemoteCondition() Condition { |
| 729 |
return Condition{C.pn_connection_remote_condition(c.pn)} |
| 730 |
} |
| 731 |
func (c Connection) Container() string { |
| 732 |
return C.GoString(C.pn_connection_get_container(c.pn)) |
| 733 |
} |
| 734 |
func (c Connection) SetContainer(container string) { |
| 735 |
containerC := C.CString(container) |
| 736 |
defer C.free(unsafe.Pointer(containerC)) |
| 737 |
|
| 738 |
C.pn_connection_set_container(c.pn, containerC) |
| 739 |
} |
| 740 |
func (c Connection) SetUser(user string) { |
| 741 |
userC := C.CString(user) |
| 742 |
defer C.free(unsafe.Pointer(userC)) |
| 743 |
|
| 744 |
C.pn_connection_set_user(c.pn, userC) |
| 745 |
} |
| 746 |
func (c Connection) User() string { |
| 747 |
return C.GoString(C.pn_connection_get_user(c.pn)) |
| 748 |
} |
| 749 |
func (c Connection) Hostname() string { |
| 750 |
return C.GoString(C.pn_connection_get_hostname(c.pn)) |
| 751 |
} |
| 752 |
func (c Connection) SetHostname(hostname string) { |
| 753 |
hostnameC := C.CString(hostname) |
| 754 |
defer C.free(unsafe.Pointer(hostnameC)) |
| 755 |
|
| 756 |
C.pn_connection_set_hostname(c.pn, hostnameC) |
| 757 |
} |
| 758 |
func (c Connection) RemoteContainer() string { |
| 759 |
return C.GoString(C.pn_connection_remote_container(c.pn)) |
| 760 |
} |
| 761 |
func (c Connection) RemoteHostname() string { |
| 762 |
return C.GoString(C.pn_connection_remote_hostname(c.pn)) |
| 763 |
} |
| 764 |
func (c Connection) OfferedCapabilities() Data { |
| 765 |
return Data{C.pn_connection_offered_capabilities(c.pn)} |
| 766 |
} |
| 767 |
func (c Connection) DesiredCapabilities() Data { |
| 768 |
return Data{C.pn_connection_desired_capabilities(c.pn)} |
| 769 |
} |
| 770 |
func (c Connection) Properties() Data { |
| 771 |
return Data{C.pn_connection_properties(c.pn)} |
| 772 |
} |
| 773 |
func (c Connection) RemoteOfferedCapabilities() Data { |
| 774 |
return Data{C.pn_connection_remote_offered_capabilities(c.pn)} |
| 775 |
} |
| 776 |
func (c Connection) RemoteDesiredCapabilities() Data { |
| 777 |
return Data{C.pn_connection_remote_desired_capabilities(c.pn)} |
| 778 |
} |
| 779 |
func (c Connection) RemoteProperties() Data { |
| 780 |
return Data{C.pn_connection_remote_properties(c.pn)} |
| 781 |
} |
| 782 |
func (c Connection) Transport() Transport { |
| 783 |
return Transport{C.pn_connection_transport(c.pn)} |
| 784 |
} |
| 785 |
|
| 786 |
// Wrappers for declarations in transport.h |
| 787 |
|
| 788 |
type Transport struct{ pn *C.pn_transport_t } |
| 789 |
|
| 790 |
func (t Transport) IsNil() bool { return t.pn == nil } |
| 791 |
func (t Transport) CPtr() unsafe.Pointer { return unsafe.Pointer(t.pn) } |
| 792 |
func (t Transport) SetServer() { |
| 793 |
C.pn_transport_set_server(t.pn) |
| 794 |
} |
| 795 |
func (t Transport) Free() { |
| 796 |
C.pn_transport_free(t.pn) |
| 797 |
} |
| 798 |
func (t Transport) User() string { |
| 799 |
return C.GoString(C.pn_transport_get_user(t.pn)) |
| 800 |
} |
| 801 |
func (t Transport) RequireAuth(required bool) { |
| 802 |
C.pn_transport_require_auth(t.pn, C.bool(required)) |
| 803 |
} |
| 804 |
func (t Transport) IsAuthenticated() bool { |
| 805 |
return bool(C.pn_transport_is_authenticated(t.pn)) |
| 806 |
} |
| 807 |
func (t Transport) RequireEncryption(required bool) { |
| 808 |
C.pn_transport_require_encryption(t.pn, C.bool(required)) |
| 809 |
} |
| 810 |
func (t Transport) IsEncrypted() bool { |
| 811 |
return bool(C.pn_transport_is_encrypted(t.pn)) |
| 812 |
} |
| 813 |
func (t Transport) Condition() Condition { |
| 814 |
return Condition{C.pn_transport_condition(t.pn)} |
| 815 |
} |
| 816 |
func (t Transport) Error() error { |
| 817 |
return PnError(C.pn_transport_error(t.pn)) |
| 818 |
} |
| 819 |
func (t Transport) Bind(connection Connection) int { |
| 820 |
return int(C.pn_transport_bind(t.pn, connection.pn)) |
| 821 |
} |
| 822 |
func (t Transport) Unbind() int { |
| 823 |
return int(C.pn_transport_unbind(t.pn)) |
| 824 |
} |
| 825 |
func (t Transport) Log(message string) { |
| 826 |
messageC := C.CString(message) |
| 827 |
defer C.free(unsafe.Pointer(messageC)) |
| 828 |
|
| 829 |
C.pn_transport_log(t.pn, messageC) |
| 830 |
} |
| 831 |
func (t Transport) ChannelMax() uint32 { |
| 832 |
return uint32(C.pn_transport_get_channel_max(t.pn)) |
| 833 |
} |
| 834 |
func (t Transport) SetChannelMax(channel_max uint32) int { |
| 835 |
return int(C.pn_transport_set_channel_max(t.pn, C.uint16_t(channel_max))) |
| 836 |
} |
| 837 |
func (t Transport) RemoteChannelMax() uint32 { |
| 838 |
return uint32(C.pn_transport_remote_channel_max(t.pn)) |
| 839 |
} |
| 840 |
func (t Transport) MaxFrame() uint16 { |
| 841 |
return uint16(C.pn_transport_get_max_frame(t.pn)) |
| 842 |
} |
| 843 |
func (t Transport) SetMaxFrame(size uint16) { |
| 844 |
C.pn_transport_set_max_frame(t.pn, C.uint32_t(size)) |
| 845 |
} |
| 846 |
func (t Transport) RemoteMaxFrame() uint16 { |
| 847 |
return uint16(C.pn_transport_get_remote_max_frame(t.pn)) |
| 848 |
} |
| 849 |
func (t Transport) IdleTimeout() time.Duration { |
| 850 |
return (time.Duration(C.pn_transport_get_idle_timeout(t.pn)) * time.Millisecond) |
| 851 |
} |
| 852 |
func (t Transport) SetIdleTimeout(timeout time.Duration) { |
| 853 |
C.pn_transport_set_idle_timeout(t.pn, C.pn_millis_t(timeout/time.Millisecond)) |
| 854 |
} |
| 855 |
func (t Transport) RemoteIdleTimeout() time.Duration { |
| 856 |
return (time.Duration(C.pn_transport_get_remote_idle_timeout(t.pn)) * time.Millisecond) |
| 857 |
} |
| 858 |
func (t Transport) Input(bytes string, available uint) int { |
| 859 |
bytesC := C.CString(bytes) |
| 860 |
defer C.free(unsafe.Pointer(bytesC)) |
| 861 |
|
| 862 |
return int(C.pn_transport_input(t.pn, bytesC, C.size_t(available))) |
| 863 |
} |
| 864 |
func (t Transport) Output(bytes string, size uint) int { |
| 865 |
bytesC := C.CString(bytes) |
| 866 |
defer C.free(unsafe.Pointer(bytesC)) |
| 867 |
|
| 868 |
return int(C.pn_transport_output(t.pn, bytesC, C.size_t(size))) |
| 869 |
} |
| 870 |
func (t Transport) Capacity() int { |
| 871 |
return int(C.pn_transport_capacity(t.pn)) |
| 872 |
} |
| 873 |
func (t Transport) Process(size uint) int { |
| 874 |
return int(C.pn_transport_process(t.pn, C.size_t(size))) |
| 875 |
} |
| 876 |
func (t Transport) CloseTail() int { |
| 877 |
return int(C.pn_transport_close_tail(t.pn)) |
| 878 |
} |
| 879 |
func (t Transport) Pending() int { |
| 880 |
return int(C.pn_transport_pending(t.pn)) |
| 881 |
} |
| 882 |
func (t Transport) Peek(dst string, size uint) int { |
| 883 |
dstC := C.CString(dst) |
| 884 |
defer C.free(unsafe.Pointer(dstC)) |
| 885 |
|
| 886 |
return int(C.pn_transport_peek(t.pn, dstC, C.size_t(size))) |
| 887 |
} |
| 888 |
func (t Transport) Pop(size uint) { |
| 889 |
C.pn_transport_pop(t.pn, C.size_t(size)) |
| 890 |
} |
| 891 |
func (t Transport) CloseHead() int { |
| 892 |
return int(C.pn_transport_close_head(t.pn)) |
| 893 |
} |
| 894 |
func (t Transport) Quiesced() bool { |
| 895 |
return bool(C.pn_transport_quiesced(t.pn)) |
| 896 |
} |
| 897 |
func (t Transport) Closed() bool { |
| 898 |
return bool(C.pn_transport_closed(t.pn)) |
| 899 |
} |
| 900 |
func (t Transport) Tick(now int64) int64 { |
| 901 |
return int64(C.pn_transport_tick(t.pn, C.int64_t(now))) |
| 902 |
} |
| 903 |
func (t Transport) Connection() Connection { |
| 904 |
return Connection{C.pn_transport_connection(t.pn)} |
| 905 |
} |
| 906 |
|
| 907 |
// Wrappers for declarations in sasl.h |
| 908 |
|
| 909 |
type SASLOutcome C.pn_sasl_outcome_t |
| 910 |
|
| 911 |
const ( |
| 912 |
SASLNone SASLOutcome = C.PN_SASL_NONE |
| 913 |
SASLOk SASLOutcome = C.PN_SASL_OK |
| 914 |
SASLAuth SASLOutcome = C.PN_SASL_AUTH |
| 915 |
SASLSys SASLOutcome = C.PN_SASL_SYS |
| 916 |
SASLPerm SASLOutcome = C.PN_SASL_PERM |
| 917 |
SASLTemp SASLOutcome = C.PN_SASL_TEMP |
| 918 |
) |
| 919 |
|
| 920 |
func (e SASLOutcome) String() string { |
| 921 |
switch e { |
| 922 |
|
| 923 |
case C.PN_SASL_NONE: |
| 924 |
return "SASLNone" |
| 925 |
case C.PN_SASL_OK: |
| 926 |
return "SASLOk" |
| 927 |
case C.PN_SASL_AUTH: |
| 928 |
return "SASLAuth" |
| 929 |
case C.PN_SASL_SYS: |
| 930 |
return "SASLSys" |
| 931 |
case C.PN_SASL_PERM: |
| 932 |
return "SASLPerm" |
| 933 |
case C.PN_SASL_TEMP: |
| 934 |
return "SASLTemp" |
| 935 |
} |
| 936 |
return "unknown" |
| 937 |
} |
| 938 |
|
| 939 |
type SASL struct{ pn *C.pn_sasl_t } |
| 940 |
|
| 941 |
func (s SASL) IsNil() bool { return s.pn == nil } |
| 942 |
func (s SASL) CPtr() unsafe.Pointer { return unsafe.Pointer(s.pn) } |
| 943 |
func (s SASL) Done(outcome SASLOutcome) { |
| 944 |
C.pn_sasl_done(s.pn, C.pn_sasl_outcome_t(outcome)) |
| 945 |
} |
| 946 |
func (s SASL) Outcome() SASLOutcome { |
| 947 |
return SASLOutcome(C.pn_sasl_outcome(s.pn)) |
| 948 |
} |
| 949 |
func (s SASL) User() string { |
| 950 |
return C.GoString(C.pn_sasl_get_user(s.pn)) |
| 951 |
} |
| 952 |
func (s SASL) Mech() string { |
| 953 |
return C.GoString(C.pn_sasl_get_mech(s.pn)) |
| 954 |
} |
| 955 |
func (s SASL) AllowedMechs(mechs string) { |
| 956 |
mechsC := C.CString(mechs) |
| 957 |
defer C.free(unsafe.Pointer(mechsC)) |
| 958 |
|
| 959 |
C.pn_sasl_allowed_mechs(s.pn, mechsC) |
| 960 |
} |
| 961 |
func (s SASL) SetAllowInsecureMechs(insecure bool) { |
| 962 |
C.pn_sasl_set_allow_insecure_mechs(s.pn, C.bool(insecure)) |
| 963 |
} |
| 964 |
func (s SASL) AllowInsecureMechs() bool { |
| 965 |
return bool(C.pn_sasl_get_allow_insecure_mechs(s.pn)) |
| 966 |
} |
| 967 |
func (s SASL) ConfigName(name string) { |
| 968 |
nameC := C.CString(name) |
| 969 |
defer C.free(unsafe.Pointer(nameC)) |
| 970 |
|
| 971 |
C.pn_sasl_config_name(s.pn, nameC) |
| 972 |
} |
| 973 |
func (s SASL) ConfigPath(path string) { |
| 974 |
pathC := C.CString(path) |
| 975 |
defer C.free(unsafe.Pointer(pathC)) |
| 976 |
|
| 977 |
C.pn_sasl_config_path(s.pn, pathC) |
| 978 |
} |