X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fstream.h;h=51a765665af0377d94805f956355d3690b3f6a56;hb=13c0dbe79a50c412721a5df697c6a6303b22d2da;hp=d05107dea7423f1ad990d8974f3ec669dfa464b3;hpb=f39dc942afd5fe241903aada30850a1d96122c8c;p=sliver-openvswitch.git diff --git a/lib/stream.h b/lib/stream.h index d05107dea..51a765665 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010 Nicira Networks. + * Copyright (c) 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,9 @@ #include #include #include +#include +#include "openvswitch/types.h" +#include "vlog.h" struct pstream; struct stream; @@ -32,10 +35,10 @@ int stream_open(const char *name, struct stream **); 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); @@ -62,7 +65,7 @@ int pstream_accept(struct pstream *, struct stream **); int pstream_accept_block(struct pstream *, struct stream **); void pstream_wait(struct pstream *); -/* Convenience funtions. */ +/* Convenience functions. */ int stream_open_with_default_ports(const char *name, uint16_t default_tcp_port, @@ -72,5 +75,17 @@ int pstream_open_with_default_ports(const char *name, uint16_t default_ptcp_port, uint16_t default_pssl_port, struct pstream **); + +/* Error reporting. */ + +enum stream_content_type { + STREAM_UNKNOWN, + STREAM_OPENFLOW, + STREAM_SSL, + STREAM_JSONRPC +}; + +void stream_report_content(const void *, ssize_t, enum stream_content_type, + struct vlog_module *, const char *stream_name); #endif /* stream.h */