hunting/utils/SharedData/include/SharedData.h
2024-04-18 22:35:31 +08:00

42 lines
1.4 KiB
C

/*
* Copyright (c) 2023 Fancy Code.
* 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 SHARED_DATA_H
#define SHARED_DATA_H
#include "StatusCode.h"
#ifdef __cplusplus
extern "C" {
#endif
enum SHARED_DATA_CODE
{
SHARED_DATA_CODE_INIT_FAILED = STATUS_CODE_END,
SHARED_DATA_CODE_WRONG_PEER_PARAMETERS,
SHARED_DATA_CODE_END
};
enum SHARER_NAME
{
SHARER_NAME_PRIMARY = 0,
SHARER_NAME_MINOR,
SHARER_NAME_END
};
void *CreateSharedData(const enum SHARER_NAME name, const char *path, const int projectId);
const StatusCode IMakeSharedData(void *object, const unsigned int readableSize, const unsigned int writableSize);
const StatusCode ICleanSharedData(void *object);
const StatusCode IGetReadableData(void *object, void *buf, const unsigned int bufLength);
void ISetWritableData(void *object, void *buf, const unsigned int bufLength);
void IShareDataFree(void *object);
#ifdef __cplusplus
}
#endif
#endif