diff options
author | fburton | 2011-08-24 19:58:19 +0000 |
---|---|---|
committer | fburton | 2011-08-24 19:58:19 +0000 |
commit | 9e706af6baa6ae982254ac65d8b8df297094dda7 (patch) | |
tree | 964a9eb845a03864fdebf8f7a96add4a3aac3964 | |
parent | 70cea7b22281b3d6c058a85786bc850d3275cf0c (diff) | |
download | org.eclipse.tcf.agent-9e706af6baa6ae982254ac65d8b8df297094dda7.tar.gz org.eclipse.tcf.agent-9e706af6baa6ae982254ac65d8b8df297094dda7.tar.xz org.eclipse.tcf.agent-9e706af6baa6ae982254ac65d8b8df297094dda7.zip |
agent: add functions to retrieve host and target channel from either of the channels
-rw-r--r-- | framework/proxy.c | 20 | ||||
-rw-r--r-- | framework/proxy.h | 14 |
2 files changed, 34 insertions, 0 deletions
diff --git a/framework/proxy.c b/framework/proxy.c index 94573c26..d87502da 100644 --- a/framework/proxy.c +++ b/framework/proxy.c @@ -286,6 +286,26 @@ void proxy_create(Channel * c1, Channel * c2) { channel_start(c2); } +Channel *proxy_get_host_channel(Channel * c) +{ + Proxy * proxy = (Proxy *)c->client_data; + + if (c->connecting != proxy_connecting || proxy == NULL || c != proxy->c) + return NULL; + if (proxy->other == -1) proxy--; + return proxy[0].c; +} + +Channel *proxy_get_target_channel(Channel * c) +{ + Proxy * proxy = (Proxy *)c->client_data; + + if (c->connecting != proxy_connecting || proxy == NULL || c != proxy->c) + return NULL; + if (proxy->other == -1) proxy--; + return proxy[1].c; +} + void add_channel_redirection_listener(ChannelRedirectionListener listener) { assert(redirection_listeners_cnt < (int)(sizeof(redirection_listeners) / sizeof(ChannelRedirectionListener))); redirection_listeners[redirection_listeners_cnt++] = listener; diff --git a/framework/proxy.h b/framework/proxy.h index 5a45858d..e52da3e5 100644 --- a/framework/proxy.h +++ b/framework/proxy.h @@ -34,4 +34,18 @@ extern void add_channel_redirection_listener(ChannelRedirectionListener listener extern void proxy_create(Channel * c1, Channel * c2); +/* + * Retrieve host (upstream) channel for proxy connection. Channel + * argument can be either the host or the target channel. Returns + * NULL if not a proxy connection. + */ +extern Channel *proxy_get_host_channel(Channel * c); + +/* + * Retrieve target (downstream) channel for proxy connection. Channel + * argument can be either the host or the target channel. Returns + * NULL if not a proxy connection. + */ +extern Channel *proxy_get_target_channel(Channel * c); + #endif /* D_proxy */ |