Proactive Safety Framework  1.0
posix_msg_que.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11 */
23 #ifndef POSIX_MSG_QUEUE_H
24 #define POSIX_MSG_QUEUE_H
25 
26 #include <mqueue.h>
27 #include <stddef.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #define MQ_PERMISSIONS 0660
37 
41 #define MQ_MAX_MESSAGES 10
42 
46 #define MQ_MAX_MSG_SIZE 2048
47 
51 #define MQ_MSG_BUFFER_SIZE (MQ_MAX_MSG_SIZE + 32)
52 
56 #define MSG_PRIO_DEFAULT 10
57 
63 typedef enum NvPSFMsgQueEndpointType_t {
68 
75 typedef enum NvPSFMsgQueBlockingMode_t {
76  BLOCKING = 0,
79 
84 typedef enum NvPSFMsgQueErr_t {
86  NvPSFMSGQ_FAIL = 1
88 
93 typedef union NvPSFMsgQueRetCode_t {
94  int mqd;
95  int errCode;
98 
106 typedef struct NvPSFMsgQueStatus_t {
110 
123 NvPSFMsgQueStatus NvPSFMsgQueCreate(const char* name, const NvPSFMsgQueEndpointType endpointType,
124  const NvPSFMsgQueBlockingMode blockingMode);
125 
136 
148 
163 NvPSFMsgQueStatus NvPSFMsgQueSend(mqd_t mqdes, const char* msg, size_t msgLen, unsigned int priority);
164 
179 NvPSFMsgQueStatus NvPSFMsgQueReceive(mqd_t mqdes, char* buffer, size_t bufferLen, unsigned int* priority);
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif // POSIX_MSG_QUEUE_H
NvPSFMsgQueStatus NvPSFMsgQueCreate(const char *name, const NvPSFMsgQueEndpointType endpointType, const NvPSFMsgQueBlockingMode blockingMode)
Create a message queue.
NvPSFMsgQueStatus NvPSFMsgQueReceive(mqd_t mqdes, char *buffer, size_t bufferLen, unsigned int *priority)
Receive a message from the message queue.
NvPSFMsgQueStatus NvPSFMsgQueClose(mqd_t mqdes)
Close a message queue.
NvPSFMsgQueStatus NvPSFMsgQueUnlink(const char *name)
Unlink (delete) a message queue.
NvPSFMsgQueBlockingMode
Definition: posix_msg_que.h:75
@ NON_BLOCKING
Definition: posix_msg_que.h:77
@ BLOCKING
Definition: posix_msg_que.h:76
NvPSFMsgQueStatus NvPSFMsgQueSend(mqd_t mqdes, const char *msg, size_t msgLen, unsigned int priority)
Send a message over the message queue.
NvPSFMsgQueErr
Definition: posix_msg_que.h:84
@ NvPSFMSGQ_FAIL
Definition: posix_msg_que.h:86
@ NvPSFMSGQ_SUCCESS
Definition: posix_msg_que.h:85
NvPSFMsgQueEndpointType
Definition: posix_msg_que.h:63
@ MSG_QUE_SENDER
Definition: posix_msg_que.h:65
@ MSG_QUE_RECEIVER
Definition: posix_msg_que.h:64
@ MSG_QUE_BIDIRECTIONAL
Definition: posix_msg_que.h:66
Definition: posix_msg_que.h:106
NvPSFMsgQueRetCode retCode
Definition: posix_msg_que.h:108
NvPSFMsgQueErr err
Definition: posix_msg_que.h:107
Definition: posix_msg_que.h:93
int recvd_bytes
Definition: posix_msg_que.h:96
int errCode
Definition: posix_msg_que.h:95
int mqd
Definition: posix_msg_que.h:94