blob: b85a58478e6da712eaab8af442b4d9b5c6565707 [file] [log] [blame]
Mark Salyzyn0175b072014-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 Cherry6ec71e92020-05-04 12:53:36 -070017#pragma once
Mark Salyzyn0175b072014-02-26 09:50:16 -080018
19#include <sysutils/SocketListener.h>
Mark Salyzyn2ad0bd02016-02-23 08:55:43 -080020
Tom Cherry283c9a12020-05-14 19:25:05 -070021#include "LogBuffer.h"
Tom Cherry68630a02020-05-11 16:29:29 -070022#include "LogReaderList.h"
Tom Cherry6ec71e92020-05-04 12:53:36 -070023#include "LogReaderThread.h"
Hao Wangf6e22962017-12-04 14:10:40 +080024
Mark Salyzyn5c77ad52016-02-23 08:55:43 -080025#define LOGD_SNDTIMEO 32
26
Mark Salyzyn0175b072014-02-26 09:50:16 -080027class LogReader : public SocketListener {
Tom Cherry68630a02020-05-11 16:29:29 -070028 public:
29 explicit LogReader(LogBuffer* logbuf, LogReaderList* reader_list);
Mark Salyzyn0175b072014-02-26 09:50:16 -080030
Tom Cherry68630a02020-05-11 16:29:29 -070031 protected:
Mark Salyzyn501c3732017-03-10 14:31:54 -080032 virtual bool onDataAvailable(SocketClient* cli);
Mark Salyzyn0175b072014-02-26 09:50:16 -080033
Tom Cherry68630a02020-05-11 16:29:29 -070034 private:
Mark Salyzyndfc47e82014-03-24 10:26:47 -070035 static int getLogSocket();
36
Tom Cherry283c9a12020-05-14 19:25:05 -070037 bool DoSocketDelete(SocketClient* cli);
Tom Cherry68630a02020-05-11 16:29:29 -070038
39 LogBuffer* log_buffer_;
40 LogReaderList* reader_list_;
Mark Salyzyn0175b072014-02-26 09:50:16 -080041};