blob: 7df3f6bb6961dbdbb9c7ebb72ae3cd4092728115 [file] [log] [blame]
Mark Salyzyn12bac902014-02-26 09:50:16 -08001/*
2 * Copyright (C) 2012-2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Tom Cherry1647cd42020-05-04 12:53:36 -070017#pragma once
Mark Salyzyn12bac902014-02-26 09:50:16 -080018
19#include <sysutils/SocketListener.h>
Mark Salyzyn1d21d542016-02-23 08:55:43 -080020
Tom Cherry5ecfbf02020-05-11 16:29:29 -070021#include "LogReaderList.h"
Tom Cherry1647cd42020-05-04 12:53:36 -070022#include "LogReaderThread.h"
Hao Wang10d19f62017-12-04 14:10:40 +080023
Mark Salyzyn2296d332016-02-23 08:55:43 -080024#define LOGD_SNDTIMEO 32
25
Mark Salyzyn1d21d542016-02-23 08:55:43 -080026class LogBuffer;
Mark Salyzyn12bac902014-02-26 09:50:16 -080027
28class LogReader : public SocketListener {
Tom Cherry5ecfbf02020-05-11 16:29:29 -070029 public:
30 explicit LogReader(LogBuffer* logbuf, LogReaderList* reader_list);
Mark Salyzyn12bac902014-02-26 09:50:16 -080031
Tom Cherry5ecfbf02020-05-11 16:29:29 -070032 LogBuffer* log_buffer() const { return log_buffer_; }
Mark Salyzyn12bac902014-02-26 09:50:16 -080033
Tom Cherry5ecfbf02020-05-11 16:29:29 -070034 protected:
Mark Salyzyn65059532017-03-10 14:31:54 -080035 virtual bool onDataAvailable(SocketClient* cli);
Mark Salyzyn12bac902014-02-26 09:50:16 -080036
Tom Cherry5ecfbf02020-05-11 16:29:29 -070037 private:
Mark Salyzyn3f6151e2014-03-24 10:26:47 -070038 static int getLogSocket();
39
Mark Salyzyn65059532017-03-10 14:31:54 -080040 void doSocketDelete(SocketClient* cli);
Tom Cherry5ecfbf02020-05-11 16:29:29 -070041
42 LogBuffer* log_buffer_;
43 LogReaderList* reader_list_;
Mark Salyzyn12bac902014-02-26 09:50:16 -080044};