param_request.h 1.5 KB
Newer Older
Z
zhong_ning 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2020 Huawei Device Co., Ltd.
 * 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.
 */

Z
zhong_ning 已提交
16 17
#ifndef BASE_STARTUP_PARAM_REQUEST_H
#define BASE_STARTUP_PARAM_REQUEST_H
Z
zhong_ning 已提交
18 19

#include <stdio.h>
Z
zhong_ning 已提交
20 21
#include "sys_param.h"
#include "param_manager.h"
Z
zhong_ning 已提交
22 23 24 25 26 27 28 29 30

#include "uv.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

typedef enum RequestType {
Z
zhong_ning 已提交
31 32
    SET_PARAM,
    GET_PARAM,
Z
zhong_ning 已提交
33 34 35
} RequestType;

typedef struct {
Z
zhong_ning 已提交
36
    ParamSecurityLabel securitylabel;
Z
zhong_ning 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    RequestType type;
    int contentSize;
    char content[0];
} RequestMsg;

typedef struct {
    RequestType type;
    int result;
    int contentSize;
    char content[0];
} ResponseMsg;

typedef struct {
    uv_loop_t *loop;
    uv_connect_t connect;
    uv_pipe_t handle;
Z
zhong_ning 已提交
53
    uv_write_t wr;
Z
zhong_ning 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    int result;
    RequestMsg msg;
} RequestNode;

typedef struct {
    uv_write_t writer;
    ResponseMsg msg;
} ResponseNode;

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif