/*
 * Copyright (c) Hisilicon Technologies Co., Ltd. 2012-2019. All rights reserved.
 * Description: mpi_rm.h
 * Author: sm_rm
 * Create: 2012-12-01
 */

#ifndef __MPI_RM_H__
#define __MPI_RM_H__

#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
#include <limits.h>

#include "td_type.h"
#include "drv_rm_struct.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

typedef enum {
    EXT_RM_TASK_STATUS_RUNNING,
    EXT_RM_TASK_STATUS_PAUSED,
    EXT_RM_TASK_STATUS_MAX,
} ext_rm_task_status;

typedef struct {
    td_void *client;
    td_u32 event;
    td_u32 pid;
    ext_rm_event_cb_fn pfn_rm_event_callback;
} ext_rm_cb_instance;

typedef struct {
    td_handle rm_handle;
    td_bool thread_run;
    td_bool task_start;
    td_bool query_path_exist;
    td_u32 pid;
    ext_rm_task_status task_status;
    pthread_t rm_query_thd_inst;         /* run handle of rm query thread */
    pthread_attr_t rm_query_thread_attr; /* attribute of rm query thread */
    td_bool call_backing;
    td_bool event_querying;
    td_bool instance_copying;
} ext_rm_ctx;

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif /* __MPI_RM_H__ */