1 /* 2 * hunt-proton: AMQP Protocol library for D programming language. 3 * 4 * Copyright (C) 2018-2019 HuntLabs 5 * 6 * Website: https://www.huntlabs.net/ 7 * 8 * Licensed under the Apache-2.0 License. 9 * 10 */ 11 12 13 module hunt.proton.amqp.transport.Transfer; 14 15 import hunt.logging; 16 import hunt.proton.amqp.Binary; 17 import hunt.proton.amqp.UnsignedInteger; 18 import hunt.proton.amqp.transport.FrameBody; 19 import hunt.proton.amqp.transport.ReceiverSettleMode; 20 import hunt.proton.amqp.transport.DeliveryState; 21 import hunt.Boolean; 22 23 class Transfer : FrameBody 24 { 25 private UnsignedInteger _handle; 26 private UnsignedInteger _deliveryId; 27 private Binary _deliveryTag; 28 private UnsignedInteger _messageFormat; 29 private Boolean _settled; // 30 private Boolean _more; 31 private ReceiverSettleMode _rcvSettleMode; 32 private DeliveryState _state; 33 private Boolean _resume; 34 private Boolean _aborted; 35 private Boolean _batchable; 36 37 this() { 38 // _settled = new Boolean(false); 39 _more = new Boolean(false); 40 _resume = new Boolean(false); 41 _aborted = new Boolean(false); 42 _batchable = new Boolean(false); 43 } 44 45 this(Transfer other) 46 { 47 this._handle = other.getHandle(); 48 this._deliveryId = other.getDeliveryId(); 49 this._deliveryTag = Binary.copy(other.getDeliveryTag()); 50 this._messageFormat = other.getMessageFormat(); 51 this._settled = other.getSettled(); 52 this._more = other.getMore(); 53 this._rcvSettleMode = other.getRcvSettleMode(); 54 this._state = other.getState(); 55 this._resume = other.getResume(); 56 this._aborted = other.getAborted(); 57 this._batchable = other.getBatchable(); 58 } 59 60 public UnsignedInteger getHandle() 61 { 62 return _handle; 63 } 64 65 public void setHandle(UnsignedInteger handle) 66 { 67 if( handle is null ) 68 { 69 logError("the handle field is mandatory"); 70 } 71 72 _handle = handle; 73 } 74 75 public UnsignedInteger getDeliveryId() 76 { 77 return _deliveryId; 78 } 79 80 public void setDeliveryId(UnsignedInteger deliveryId) 81 { 82 _deliveryId = deliveryId; 83 } 84 85 public Binary getDeliveryTag() 86 { 87 return _deliveryTag; 88 } 89 90 public void setDeliveryTag(Binary deliveryTag) 91 { 92 _deliveryTag = deliveryTag; 93 } 94 95 public UnsignedInteger getMessageFormat() 96 { 97 return _messageFormat; 98 } 99 100 public void setMessageFormat(UnsignedInteger messageFormat) 101 { 102 _messageFormat = messageFormat; 103 } 104 105 public Boolean getSettled() 106 { 107 return _settled; 108 } 109 110 public void setSettled(Boolean settled) 111 { 112 _settled = settled; 113 } 114 115 public Boolean getMore() 116 { 117 return _more; 118 } 119 120 public void setMore(Boolean more) 121 { 122 _more = more; 123 } 124 125 public ReceiverSettleMode getRcvSettleMode() 126 { 127 return _rcvSettleMode; 128 } 129 130 public void setRcvSettleMode(ReceiverSettleMode rcvSettleMode) 131 { 132 _rcvSettleMode = rcvSettleMode; 133 } 134 135 public DeliveryState getState() 136 { 137 return _state; 138 } 139 140 public void setState(DeliveryState state) 141 { 142 _state = state; 143 } 144 145 public Boolean getResume() 146 { 147 return _resume; 148 } 149 150 public void setResume(Boolean resume) 151 { 152 _resume = resume; 153 } 154 155 public Boolean getAborted() 156 { 157 return _aborted; 158 } 159 160 public void setAborted(Boolean aborted) 161 { 162 _aborted = aborted; 163 } 164 165 public Boolean getBatchable() 166 { 167 return _batchable; 168 } 169 170 public void setBatchable(Boolean batchable) 171 { 172 _batchable = batchable; 173 } 174 175 //override 176 public void invoke(E)(FrameBodyHandler!E handler, Binary payload, E context) 177 { 178 handler.handleTransfer(this, payload, context); 179 } 180 181 182 public FrameBody copy() 183 { 184 return new Transfer(this); 185 } 186 }