From 923477dcade212c1d566b4a846113ac82a0870ce Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 25 Sep 2018 09:55:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9D=83=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BB=A5=E5=8F=8A=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpRequestSplitter.cpp | 37 +++++++++++++++++++++++++++++--- src/Http/HttpRequestSplitter.h | 33 +++++++++++++++++++++++++--- src/Http/WebSocketSplitter.cpp | 35 +++++++++++++++++++++++++++--- src/Http/WebSocketSplitter.h | 35 +++++++++++++++++++++++++++--- src/Rtsp/RtspSession.h | 2 ++ 5 files changed, 130 insertions(+), 12 deletions(-) diff --git a/src/Http/HttpRequestSplitter.cpp b/src/Http/HttpRequestSplitter.cpp index c972cd2b..10375789 100644 --- a/src/Http/HttpRequestSplitter.cpp +++ b/src/Http/HttpRequestSplitter.cpp @@ -1,12 +1,38 @@ -// -// Created by xzl on 2018/9/20. -// +/* + * MIT License + * + * Copyright (c) 2016 xiongziliang <771730766@qq.com> + * + * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + #include "HttpRequestSplitter.h" #include "Util/logger.h" #include "Util/util.h" using namespace ZL::Util; +namespace ZL { +namespace Http { + void HttpRequestSplitter::input(const char *data,uint64_t len) { const char *ptr = data; if(!_remain_data.empty()){ @@ -79,3 +105,8 @@ void HttpRequestSplitter::reset() { _content_len = 0; _remain_data.clear(); } + + +} /* namespace Http */ +} /* namespace ZL */ + diff --git a/src/Http/HttpRequestSplitter.h b/src/Http/HttpRequestSplitter.h index c710ef60..f0781e85 100644 --- a/src/Http/HttpRequestSplitter.h +++ b/src/Http/HttpRequestSplitter.h @@ -1,6 +1,28 @@ -// -// Created by xzl on 2018/9/20. -// +/* + * MIT License + * + * Copyright (c) 2016 xiongziliang <771730766@qq.com> + * + * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef ZLMEDIAKIT_HTTPREQUESTSPLITTER_H #define ZLMEDIAKIT_HTTPREQUESTSPLITTER_H @@ -8,6 +30,9 @@ #include using namespace std; +namespace ZL { +namespace Http { + class HttpRequestSplitter { public: HttpRequestSplitter(){}; @@ -54,5 +79,7 @@ private: int64_t _content_len = 0; }; +} /* namespace Http */ +} /* namespace ZL */ #endif //ZLMEDIAKIT_HTTPREQUESTSPLITTER_H diff --git a/src/Http/WebSocketSplitter.cpp b/src/Http/WebSocketSplitter.cpp index 78c82426..99612a24 100644 --- a/src/Http/WebSocketSplitter.cpp +++ b/src/Http/WebSocketSplitter.cpp @@ -1,6 +1,28 @@ -// -// Created by xzl on 2018/9/21. -// +/* + * MIT License + * + * Copyright (c) 2016 xiongziliang <771730766@qq.com> + * + * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include "WebSocketSplitter.h" #include @@ -9,6 +31,11 @@ #include "Util/logger.h" #include "Util/util.h" using namespace ZL::Util; + + +namespace ZL { +namespace Http { + /** * 0 1 2 3 @@ -176,6 +203,8 @@ void WebSocketSplitter::encode(uint8_t *data, uint64_t len) { +} /* namespace Http */ +} /* namespace ZL */ diff --git a/src/Http/WebSocketSplitter.h b/src/Http/WebSocketSplitter.h index e1f1266e..4fa56fd9 100644 --- a/src/Http/WebSocketSplitter.h +++ b/src/Http/WebSocketSplitter.h @@ -1,6 +1,28 @@ -// -// Created by xzl on 2018/9/21. -// +/* + * MIT License + * + * Copyright (c) 2016 xiongziliang <771730766@qq.com> + * + * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef ZLMEDIAKIT_WEBSOCKETSPLITTER_H #define ZLMEDIAKIT_WEBSOCKETSPLITTER_H @@ -11,6 +33,10 @@ #include using namespace std; + +namespace ZL { +namespace Http { + class WebSocketHeader { public: typedef std::shared_ptr Ptr; @@ -96,5 +122,8 @@ private: uint64_t _playload_offset = 0; }; +} /* namespace Http */ +} /* namespace ZL */ + #endif //ZLMEDIAKIT_WEBSOCKETSPLITTER_H diff --git a/src/Rtsp/RtspSession.h b/src/Rtsp/RtspSession.h index b463a56a..b5d3bfe3 100644 --- a/src/Rtsp/RtspSession.h +++ b/src/Rtsp/RtspSession.h @@ -45,6 +45,8 @@ using namespace ZL::Util; using namespace ZL::Rtsp; using namespace ZL::Player; using namespace ZL::Network; +using namespace ZL::Http; + namespace ZL { namespace Rtsp {