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 module hunt.proton.engine.Endpoint;
13 import hunt.proton.engine.Extendable;
14 import hunt.proton.engine.EndpointState;
15 
16 import hunt.proton.amqp.transport.ErrorCondition;
17 
18 interface Endpoint : Extendable
19 {
20     /**
21      * @return the local endpoint state
22      */
23     public EndpointState getLocalState();
24 
25     /**
26      * @return the remote endpoint state (as last communicated)
27      */
28     public EndpointState getRemoteState();
29 
30     /**
31      * @return the local endpoint error, or null if there is none
32      */
33     public ErrorCondition getCondition();
34 
35     /**
36      * Set the local error condition
37      * @param condition
38      */
39     public void setCondition(ErrorCondition condition);
40 
41     /**
42      * @return the remote endpoint error, or null if there is none
43      */
44     public ErrorCondition getRemoteCondition();
45 
46     /**
47      * free the endpoint and any associated resources
48      */
49     public void free();
50 
51     /**
52      * transition local state to ACTIVE
53      */
54     void open();
55 
56     /**
57      * transition local state to CLOSED
58      */
59     void close();
60 
61     /**
62      * Sets an arbitrary an application owned object on the end-point.  This object
63      * is not used by Proton.
64      */
65     public void setContext(Object o);
66 
67     /**
68      * @see #setContext(Object)
69      */
70     public Object getContext();
71 
72 }