Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93998442 authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by The Android Open Source Project
Browse files

am 747baadd: Merge change 1092 into donut

Merge commit '747baadd'

* commit '747baadd':
  libsysutils: New C++ system convenience library
parents 493726bc 747baadd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ else
  include $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
	      adb \
	      libcutils \
	      libsysutils \
	      liblog \
	      libnetutils \
	      libpixelflinger \
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * 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 __FRAMEWORK_CMD_HANDLER_H
#define __FRAMEWORK_CMD_HANDLER_H

#include "../../../frameworks/base/include/utils/List.h"


class FrameworkCommand { 
private:
    const char *mCommand;

public:

    FrameworkCommand(const char *cmd);
    virtual ~FrameworkCommand() { }

    virtual int runCommand(char *data);

    const char *getCommand() { return mCommand; }
};

typedef android::List<FrameworkCommand *> FrameworkCommandCollection;
#endif
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * 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 _FRAMEWORKSOCKETLISTENER_H
#define _FRAMEWORKSOCKETLISTENER_H

#include "SocketListener.h"
#include "FrameworkCommand.h"

class FrameworkListener : public SocketListener {
private:
    FrameworkCommandCollection *mCommands;

public:
    FrameworkListener(const char *socketName);
    virtual ~FrameworkListener() {}

protected:
    void registerCmd(FrameworkCommand *cmd);
    virtual bool onDataAvailable(int socket);

private:
    void dispatchCommand(char *cmd);
};
#endif
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * 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 _FRAMEWORKMANAGER_H
#define _FRAMEWORKMANAGER_H

#include <pthread.h>

class FrameworkListener;

class FrameworkManager {
    int mDoorbell;        // Socket used to accept connections from framework
    int mFwSock;          // Socket used to communicate with framework
    const char *mSocketName;

    FrameworkListener *mListener;
    
    pthread_mutex_t mWriteMutex;

public:
    FrameworkManager(FrameworkListener *Listener);
    virtual ~FrameworkManager() {}

    int run();
    int sendMsg(char *msg);
    int sendMsg(char *msg, char *data);
};
#endif
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * 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 _NETLINKEVENT_H
#define _NETLINKEVENT_H

#define NL_PARAMS_MAX 32

class NetlinkEvent {
    int  mSeq;
    char *mPath;
    int  mAction;
    char *mSubsystem;
    char *mParams[NL_PARAMS_MAX];

public:
    const static int NlActionUnknown;
    const static int NlActionAdd;
    const static int NlActionRemove;
    const static int NlActionChange;

    NetlinkEvent();
    virtual ~NetlinkEvent();

    bool decode(char *buffer, int size);
    const char *findParam(const char *paramName);

    const char *getSubsystem() { return mSubsystem; }
    int getAction() { return mAction; }
};

#endif
Loading