/*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct stream_class *class;
int state;
int error;
- uint32_t remote_ip;
- uint16_t remote_port;
- uint32_t local_ip;
- uint16_t local_port;
+ ovs_be32 remote_ip;
+ ovs_be16 remote_port;
+ ovs_be32 local_ip;
+ ovs_be16 local_port;
char *name;
};
void stream_init(struct stream *, struct stream_class *, int connect_status,
const char *name);
-void stream_set_remote_ip(struct stream *, uint32_t remote_ip);
-void stream_set_remote_port(struct stream *, uint16_t remote_port);
-void stream_set_local_ip(struct stream *, uint32_t local_ip);
-void stream_set_local_port(struct stream *, uint16_t local_port);
+void stream_set_remote_ip(struct stream *, ovs_be32 remote_ip);
+void stream_set_remote_port(struct stream *, ovs_be16 remote_port);
+void stream_set_local_ip(struct stream *, ovs_be32 local_ip);
+void stream_set_local_port(struct stream *, ovs_be16 local_port);
static inline void stream_assert_class(const struct stream *stream,
const struct stream_class *class)
{
/* 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
+ovs_be32
stream_get_remote_ip(const struct stream *stream)
{
return stream->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
+ovs_be16
stream_get_remote_port(const struct stream *stream)
{
return stream->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
+ovs_be32
stream_get_local_ip(const struct stream *stream)
{
return stream->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
+ovs_be16
stream_get_local_port(const struct stream *stream)
{
return stream->local_port;
}
void
-stream_set_remote_ip(struct stream *stream, uint32_t ip)
+stream_set_remote_ip(struct stream *stream, ovs_be32 ip)
{
stream->remote_ip = ip;
}
void
-stream_set_remote_port(struct stream *stream, uint16_t port)
+stream_set_remote_port(struct stream *stream, ovs_be16 port)
{
stream->remote_port = port;
}
void
-stream_set_local_ip(struct stream *stream, uint32_t ip)
+stream_set_local_ip(struct stream *stream, ovs_be32 ip)
{
stream->local_ip = ip;
}
void
-stream_set_local_port(struct stream *stream, uint16_t port)
+stream_set_local_port(struct stream *stream, ovs_be16 port)
{
stream->local_port = port;
}
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include "openvswitch/types.h"
#include "vlog.h"
struct pstream;
int stream_open_block(int error, struct stream **);
void stream_close(struct stream *);
const char *stream_get_name(const struct stream *);
-uint32_t stream_get_remote_ip(const struct stream *);
-uint16_t stream_get_remote_port(const struct stream *);
-uint32_t stream_get_local_ip(const struct stream *);
-uint16_t stream_get_local_port(const struct stream *);
+ovs_be32 stream_get_remote_ip(const struct stream *);
+ovs_be16 stream_get_remote_port(const struct stream *);
+ovs_be32 stream_get_local_ip(const struct stream *);
+ovs_be16 stream_get_local_port(const struct stream *);
int stream_connect(struct stream *);
int stream_recv(struct stream *, void *buffer, size_t n);
int stream_send(struct stream *, const void *buffer, size_t n);
/*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int error;
int min_version;
int version;
- uint32_t remote_ip;
- uint16_t remote_port;
- uint32_t local_ip;
- uint16_t local_port;
+ ovs_be32 remote_ip;
+ ovs_be16 remote_port;
+ ovs_be32 local_ip;
+ ovs_be16 local_port;
char *name;
};
void vconn_init(struct vconn *, struct vconn_class *, int connect_status,
const char *name);
-void vconn_set_remote_ip(struct vconn *, uint32_t remote_ip);
-void vconn_set_remote_port(struct vconn *, uint16_t remote_port);
-void vconn_set_local_ip(struct vconn *, uint32_t local_ip);
-void vconn_set_local_port(struct vconn *, uint16_t local_port);
+void vconn_set_remote_ip(struct vconn *, ovs_be32 remote_ip);
+void vconn_set_remote_port(struct vconn *, ovs_be16 remote_port);
+void vconn_set_local_ip(struct vconn *, ovs_be32 local_ip);
+void vconn_set_local_port(struct vconn *, ovs_be16 local_port);
static inline void vconn_assert_class(const struct vconn *vconn,
const struct vconn_class *class)
{
/* 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
+ovs_be32
vconn_get_remote_ip(const struct vconn *vconn)
{
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
+ovs_be16
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
+ovs_be32
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
+ovs_be16
vconn_get_local_port(const struct vconn *vconn)
{
return vconn->local_port;
*
* 'request' is always destroyed, regardless of the return value. */
int
-vconn_recv_xid(struct vconn *vconn, uint32_t xid, struct ofpbuf **replyp)
+vconn_recv_xid(struct vconn *vconn, ovs_be32 xid, struct ofpbuf **replyp)
{
for (;;) {
- uint32_t recv_xid;
+ ovs_be32 recv_xid;
struct ofpbuf *reply;
int error;
vconn_transact(struct vconn *vconn, struct ofpbuf *request,
struct ofpbuf **replyp)
{
- uint32_t send_xid = ((struct ofp_header *) request->data)->xid;
+ ovs_be32 send_xid = ((struct ofp_header *) request->data)->xid;
int error;
*replyp = NULL;
}
void
-vconn_set_remote_ip(struct vconn *vconn, uint32_t ip)
+vconn_set_remote_ip(struct vconn *vconn, ovs_be32 ip)
{
vconn->remote_ip = ip;
}
void
-vconn_set_remote_port(struct vconn *vconn, uint16_t port)
+vconn_set_remote_port(struct vconn *vconn, ovs_be16 port)
{
vconn->remote_port = port;
}
void
-vconn_set_local_ip(struct vconn *vconn, uint32_t ip)
+vconn_set_local_ip(struct vconn *vconn, ovs_be32 ip)
{
vconn->local_ip = ip;
}
void
-vconn_set_local_port(struct vconn *vconn, uint16_t port)
+vconn_set_local_port(struct vconn *vconn, ovs_be16 port)
{
vconn->local_port = port;
}
int vconn_open(const char *name, int min_version, struct vconn **);
void vconn_close(struct vconn *);
const char *vconn_get_name(const struct vconn *);
-uint32_t vconn_get_remote_ip(const struct vconn *);
-uint16_t vconn_get_remote_port(const struct vconn *);
-uint32_t vconn_get_local_ip(const struct vconn *);
-uint16_t vconn_get_local_port(const struct vconn *);
+ovs_be32 vconn_get_remote_ip(const struct vconn *);
+ovs_be16 vconn_get_remote_port(const struct vconn *);
+ovs_be32 vconn_get_local_ip(const struct vconn *);
+ovs_be16 vconn_get_local_port(const struct vconn *);
int vconn_connect(struct vconn *);
int vconn_recv(struct vconn *, struct ofpbuf **);
int vconn_send(struct vconn *, struct ofpbuf *);