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.codec.AMQPDefinedTypes;
14 
15 import hunt.proton.codec.messaging.DataType;
16 import hunt.proton.codec.messaging.FooterType;
17 import hunt.proton.codec.messaging.HeaderType;
18 import hunt.proton.codec.messaging.SourceType;
19 import hunt.proton.codec.messaging.TargetType;
20 import hunt.proton.codec.messaging.AcceptedType;
21 import hunt.proton.codec.messaging.ModifiedType;
22 import hunt.proton.codec.messaging.ReleasedType;
23 import hunt.proton.codec.messaging.ReceivedType;
24 import hunt.proton.codec.messaging.RejectedType;
25 import hunt.proton.codec.messaging.PropertiesType;
26 import hunt.proton.codec.messaging.DeliveryAnnotationsType;
27 import hunt.proton.codec.messaging.MessageAnnotationsType;
28 import hunt.proton.codec.messaging.ApplicationPropertiesType;
29 import hunt.proton.codec.messaging.AmqpSequenceType;
30 import hunt.proton.codec.messaging.AmqpValueType;
31 import hunt.proton.codec.messaging.DeleteOnCloseType;
32 import hunt.proton.codec.messaging.DeleteOnNoLinksType;
33 import hunt.proton.codec.messaging.DeleteOnNoMessagesType;
34 import hunt.proton.codec.messaging.DeleteOnNoLinksOrMessagesType;
35 import hunt.proton.codec.messaging.FastPathHeaderType;
36 import hunt.proton.codec.messaging.FastPathAcceptedType;
37 import hunt.proton.codec.messaging.FastPathPropertiesType;
38 import hunt.proton.codec.messaging.FastPathDeliveryAnnotationsType;
39 import hunt.proton.codec.messaging.DeleteOnNoLinksOrMessagesType;
40 import hunt.proton.codec.messaging.FastPathMessageAnnotationsType;
41 import hunt.proton.codec.messaging.FastPathApplicationPropertiesType;
42 import hunt.proton.codec.messaging.FastPathDataType;
43 import hunt.proton.codec.messaging.FastPathAmqpSequenceType;
44 import hunt.proton.codec.messaging.FastPathAmqpValueType;
45 import hunt.proton.codec.messaging.FastPathFooterType;
46 
47 
48 
49 
50 
51 
52 import hunt.proton.codec.security.SaslChallengeType;
53 import hunt.proton.codec.security.SaslInitType;
54 import hunt.proton.codec.security.SaslOutcomeType;
55 import hunt.proton.codec.security.SaslMechanismsType;
56 import hunt.proton.codec.security.SaslResponseType;
57 
58 import hunt.proton.codec.transaction.DeclareType;
59 import hunt.proton.codec.transaction.CoordinatorType;
60 import hunt.proton.codec.transaction.DischargeType;
61 import hunt.proton.codec.transaction.DeclaredType;
62 import hunt.proton.codec.transaction.TransactionalStateType;
63 
64 
65 import hunt.proton.codec.transport.OpenType;
66 import hunt.proton.codec.transport.BeginType;
67 import hunt.proton.codec.transport.AttachType;
68 import hunt.proton.codec.transport.FlowType;
69 import hunt.proton.codec.transport.TransferType;
70 import hunt.proton.codec.transport.DispositionType;
71 import hunt.proton.codec.transport.DetachType;
72 import hunt.proton.codec.transport.EndType;
73 import hunt.proton.codec.transport.CloseType;
74 import hunt.proton.codec.transport.ErrorConditionType;
75 import hunt.proton.codec.transport.FastPathFlowType;
76 import hunt.proton.codec.transport.FastPathTransferType;
77 import hunt.proton.codec.transport.FastPathDispositionType;
78 import hunt.proton.codec.Decoder;
79 import hunt.proton.codec.EncoderImpl;
80 
81 class AMQPDefinedTypes
82 {
83     public static void registerAllTypes(Decoder decoder, EncoderImpl encoder)
84     {
85         registerTransportTypes(decoder, encoder);
86         registerMessagingTypes(decoder, encoder);
87         registerTransactionTypes(decoder, encoder);
88         registerSecurityTypes(decoder, encoder);
89     }
90 
91     public static void registerTransportTypes(Decoder decoder, EncoderImpl encoder)
92     {
93         OpenType.register(decoder, encoder);
94         BeginType.register(decoder, encoder);
95         AttachType.register(decoder, encoder);
96         FlowType.register(decoder, encoder);
97         TransferType.register(decoder, encoder);
98         DispositionType.register(decoder, encoder);
99         DetachType.register(decoder, encoder);
100         EndType.register(decoder, encoder);
101         CloseType.register(decoder, encoder);
102         ErrorConditionType.register(decoder, encoder);
103 
104         FastPathFlowType.register(decoder, encoder);
105         FastPathTransferType.register(decoder, encoder);
106         FastPathDispositionType.register(decoder, encoder);
107     }
108 
109     public static void registerMessagingTypes(Decoder decoder, EncoderImpl encoder)
110     {
111         HeaderType.register(decoder, encoder);
112         AcceptedType.register(decoder , encoder);
113         PropertiesType.register( decoder, encoder );
114         DeliveryAnnotationsType.register(decoder, encoder);
115         MessageAnnotationsType.register(decoder, encoder);
116         ApplicationPropertiesType.register(decoder, encoder);
117         DataType.register(decoder, encoder);
118         AmqpSequenceType.register(decoder, encoder);
119         AmqpValueType.register(decoder, encoder);
120         FooterType.register(decoder, encoder);
121         ReceivedType.register(decoder, encoder);
122         RejectedType.register(decoder, encoder);
123         ReleasedType.register(decoder, encoder);
124         ModifiedType.register(decoder, encoder);
125         SourceType.register(decoder, encoder);
126         TargetType.register(decoder, encoder);
127         DeleteOnCloseType.register(decoder, encoder);
128         DeleteOnNoLinksType.register(decoder, encoder);
129         DeleteOnNoMessagesType.register(decoder, encoder);
130         DeleteOnNoLinksOrMessagesType.register(decoder, encoder);
131 
132         FastPathHeaderType.register(decoder, encoder);
133         FastPathAcceptedType.register(decoder , encoder);
134         FastPathPropertiesType.register( decoder, encoder );
135         FastPathDeliveryAnnotationsType.register(decoder, encoder);
136         FastPathMessageAnnotationsType.register(decoder, encoder);
137         FastPathApplicationPropertiesType.register(decoder, encoder);
138         FastPathDataType.register(decoder, encoder);
139         FastPathAmqpSequenceType.register(decoder, encoder);
140         FastPathAmqpValueType.register(decoder, encoder);
141         FastPathFooterType.register(decoder, encoder);
142     }
143 
144     public static void registerTransactionTypes(Decoder decoder, EncoderImpl encoder)
145     {
146         CoordinatorType.register(decoder, encoder);
147         DeclareType.register(decoder, encoder);
148         DischargeType.register(decoder, encoder);
149         DeclaredType.register(decoder, encoder);
150         TransactionalStateType.register(decoder, encoder);
151     }
152 
153     public static void registerSecurityTypes(Decoder decoder, EncoderImpl encoder)
154     {
155         SaslMechanismsType.register(decoder, encoder);
156         SaslInitType.register(decoder, encoder);
157         SaslChallengeType.register(decoder, encoder);
158         SaslResponseType.register(decoder, encoder);
159         SaslOutcomeType.register(decoder, encoder);
160     }
161 }