distributedschedule_samgr_lite/samgr_server/source/samgr_server.h
distributedschedule_samgr_lite/samgr_server/source/samgr_server.c
samgr_server.h
头文件中,简要定义了远程寄存器模块的一个结构体
typedef struct RemoteRegister RemoteRegister; //远程寄存器
struct RemoteRegister {
MutexId mtx; //互斥ID
Endpoint *endpoint; //端点
Vector clients; //向量客户端
};
samgr_server.c
文件开头定义了许多宏定义,和全局调用的函数
#define LOG_TAG "Samgr"
#define LOG_DOMAIN 0xD001800
typedef int(*ProcFunc)(SamgrServer *server, int32 option, void *origin, IpcIo *req, IpcIo *reply);
#define MAX_SA_SIZE 0x100
#define RETRY_TIMES 3
#define RETRY_INTERVAL 1
#define UID_HAP 10000
#define MAX_SYSCAP_NUM_PER_REPLY 118
获取要素名称功能
static const char *GetName(Service *service);
//feature表示指向该功能的指针
初始化用户的身份信息
static BOOL Initialize(Service *service, Identity identity);
//identity指示初始化的用户的身份
//service指示指向服务的指针。
定义服务的任务配置
static TaskConfig GetTaskConfig(Service *service);
处理服务消息
static BOOL MessageHandle(Service *service, Request *request);
//service指示指向服务的指针。
//request表示指向请求数据的指针。
从客户端向IServerProxy发送IPC消息
static int32 Invoke(IServerProxy *iProxy, int funcId, void *origin, IpcIo *req, IpcIo *reply);
//proxy表示客户端代理对象的指针。
//funcId表示在服务器上实现的函数的ID。
//req指示指向序列化请求消息的指针。
在终端运行结束时调用
static int OnEndpointExit(const IpcContext *context, void* ipcMsg, IpcIo* data, void* argv);
进程终端
static int ProcEndpoint(SamgrServer *server, int32 option, void *origin, IpcIo *req, IpcIo *reply);
//进程输出特性
static int32 ProcPutFeature(SamgrServer *server, const void *origin, IpcIo *req, IpcIo *reply, SvcIdentity *identity);
//进程获取功能
static int32 ProcGetFeature(SamgrServer *server, const void *origin, IpcIo *req, IpcIo *reply, SvcIdentity *identity);
//进程特征
static int ProcFeature(SamgrServer *server, int32 option, void *origin, IpcIo *req, IpcIo *reply);
//注册Samgr端点
static int RegisterSamgrEndpoint(const IpcContext* context, SvcIdentity* identity);
//传送服务信息的策略
static void TransmitPolicy(int ret, const SvcIdentity* identity, IpcIo *reply,
const PolicyTrans *policy, uint32 policyNum);
//传输固定策略
static void TransmitFixedPolicy(IpcIo *reply, PolicyTrans policy);
//Ipc身份验证接口
static IpcAuthInterface *GetIpcAuthInterface(void);
//程序系统上限
static int ProcSysCap(SamgrServer *server, int32 option, void *origin, IpcIo *req, IpcIo *reply);
//解析系统上限
static void ParseSysCap(void);
今天先介绍该文件中所调用的几条简单函数,剩下的函数将在后续博客中介绍。