1 // vim: ts=4 sw=4 noet:
3 --------------------------------------------------------------------------------
4 Copyright (c) 2018-2019 AT&T Intellectual Property.
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 --------------------------------------------------------------------------------
21 Mnemonic: test_rmr_em.c.
22 Abstract: Emulates some RMR functions (message receipt mostly)
23 so that we can unit test.
25 This file should be included by the test programme BEFORE
26 any module which uses RMR functions is included
28 Date: 10 December 2019
29 Author: E. Scott Daniels
34 #define rmr_torcv_msg RMR_torcv_msg
36 extern rmr_mbuf_t* RMR_torcv_msg( void* ctx, rmr_mbuf_t* old_msg, int ms_to ) {
37 static int timeout = 0;
39 if( old_msg == NULL ) {
40 old_msg = rmr_alloc_msg( ctx, 256 );
41 if( old_msg == NULL ) {
46 timeout = ! timeout; // every other message results in a timeout
48 old_msg->state = RMR_ERR_TIMEOUT;
53 snprintf( old_msg->payload, 100, "DUMMY MESSAGE" );
55 old_msg->len = strlen( old_msg->payload );