summaryrefslogtreecommitdiff
path: root/common/inc/SocketStream.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/inc/SocketStream.h')
-rw-r--r--common/inc/SocketStream.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/common/inc/SocketStream.h b/common/inc/SocketStream.h
new file mode 100644
index 0000000..d1631f6
--- /dev/null
+++ b/common/inc/SocketStream.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SOCKET_STREAM_H_
+#define _SOCKET_STREAM_H_
+
+#include <string>
+#include <PrivacyManagerTypes.h>
+
+class EXTERN_API SocketStream
+{
+public:
+ explicit SocketStream(int socket_fd)
+ : m_socketFd(socket_fd)
+ , m_bytesRead(0)
+ ,m_bytesWrote(0)
+ {
+// LOGI("Created");
+ }
+
+ int readStream(size_t num, void * bytes);
+ int writeStream(size_t num, const void * bytes);
+private:
+ int throwWithErrnoMessage(std::string specificInfo);
+ int m_socketFd;
+ int m_bytesRead;
+ int m_bytesWrote;
+};
+
+#endif //_SOCKET_STREAM_H_