diff options
| author | Justin Pettit <jpettit@nicira.com> | 2009-07-06 15:15:11 -0700 |
|---|---|---|
| committer | Justin Pettit <jpettit@nicira.com> | 2009-07-08 11:19:51 -0700 |
| commit | 193456d581423f894e57e8463ff5049c0d802f0a (patch) | |
| tree | 0649f9e6300bb00b86c6d84ce9a7c9827fecf726 /lib/vconn.c | |
| parent | ab9c78ff5099e6c45166b47202741b4071176ba3 (diff) | |
| download | openvswitch-193456d581423f894e57e8463ff5049c0d802f0a.tar.gz | |
Have rconn and vconn export information about IPs and ports
Previously, rconn and vconn only allowed users to find out about the
remote IP address. This set of changes allows users to retrieve the
remote port, local IP, and local port used for the connection.
Diffstat (limited to 'lib/vconn.c')
| -rw-r--r-- | lib/vconn.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/lib/vconn.c b/lib/vconn.c index a006efbea..2940c114d 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -251,9 +251,34 @@ vconn_get_name(const struct vconn *vconn) /* Returns the IP address of the peer, or 0 if the peer is not connected over * an IP-based protocol or if its IP address is not yet known. */ uint32_t -vconn_get_ip(const struct vconn *vconn) +vconn_get_remote_ip(const struct vconn *vconn) { - return vconn->ip; + return vconn->remote_ip; +} + +/* Returns the transport port of the peer, or 0 if the connection does not + * contain a port or if the port is not yet known. */ +uint16_t +vconn_get_remote_port(const struct vconn *vconn) +{ + return vconn->remote_port; +} + +/* Returns the IP address used to connect to the peer, or 0 if the + * connection is not an IP-based protocol or if its IP address is not + * yet known. */ +uint32_t +vconn_get_local_ip(const struct vconn *vconn) +{ + return vconn->local_ip; +} + +/* Returns the transport port used to connect to the peer, or 0 if the + * connection does not contain a port or if the port is not yet known. */ +uint16_t +vconn_get_local_port(const struct vconn *vconn) +{ + return vconn->local_port; } static void @@ -1382,7 +1407,8 @@ normalize_match(struct ofp_match *m) void vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status, - uint32_t ip, const char *name, bool reconnectable) + uint32_t remote_ip, uint16_t remote_port, const char *name, + bool reconnectable) { vconn->class = class; vconn->state = (connect_status == EAGAIN ? VCS_CONNECTING @@ -1391,11 +1417,26 @@ vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status, vconn->error = connect_status; vconn->version = -1; vconn->min_version = -1; - vconn->ip = ip; + vconn->remote_ip = remote_ip; + vconn->remote_port = remote_port; + vconn->local_ip = 0; + vconn->local_port = 0; vconn->name = xstrdup(name); vconn->reconnectable = reconnectable; } +void +vconn_set_local_ip(struct vconn *vconn, uint32_t ip) +{ + vconn->local_ip = ip; +} + +void +vconn_set_local_port(struct vconn *vconn, uint16_t port) +{ + vconn->local_port = port; +} + void pvconn_init(struct pvconn *pvconn, struct pvconn_class *class, const char *name) |
