nm_sr_peek.c
set header size on given request, i.e.
set header size on given request, i.e. send at least this size eagerly
/*
* NewMadeleine
* Copyright (C) 2016-2024 (see AUTHORS file)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include "../common/nm_examples_helper.h"
const char msg[] = "Hello, world!";
int main(int argc, char**argv)
{
void*buf = malloc(len);
nm_sr_request_t request;
nm_examples_init(&argc, argv);
{
memset(buf, 0, len);
int*p_len = buf;
printf("SUCCESS- rc = %d; header len = %d\n", rc, *p_len);
printf("buffer contents: %s\n", (char*)(buf + sizeof(int)));
}
else
{
int*p_len = buf;
strcpy(buf + sizeof(int), msg);
*p_len = len;
puk_sleep(1);
printf("# sender- header len = %d\n", *p_len);
}
free(buf);
return 0;
}
assert(p_data->ops.p_traversal !=NULL)
static void nm_data_contiguous_build(struct nm_data_s *p_data, void *ptr, nm_len_t len)
Definition nm_data.h:560
static void nm_examples_init(int *argc, char *argv[])
Definition nm_examples_helper.h:79
static void nm_sr_recv_init(nm_session_t p_session, nm_sr_request_t *p_request)
static int nm_sr_recv_peek(nm_session_t p_session, nm_sr_request_t *p_request, const struct nm_data_s *p_data)
peek for already received (unexpected) data
static int nm_sr_swait(nm_session_t p_session, nm_sr_request_t *p_request)
Wait for the completion of a non blocking send request.
static void nm_sr_recv_data_wait(nm_session_t p_session, nm_sr_request_t *p_request)
waits for first byte of data to be available, for a request posted without data descriptor
static int nm_sr_rwait(nm_session_t p_session, nm_sr_request_t *p_request)
Wait for the completion of a non blocking receive request.
static int nm_sr_recv_post(nm_session_t p_session, nm_sr_request_t *p_request)
posts the receive request to the scheduler
static void nm_sr_recv_match(nm_session_t p_session, nm_sr_request_t *p_request, nm_gate_t p_gate, nm_tag_t tag, nm_tag_t mask)
match the request with given gate/tag/mask
static void nm_sr_recv_unpack_contiguous(nm_session_t p_session, nm_sr_request_t *p_request, void *ptr, nm_len_t len)
static int nm_sr_isend(nm_session_t p_session, nm_gate_t p_gate, nm_tag_t tag, const void *data, nm_len_t len, nm_sr_request_t *p_request)
Post a non blocking send request.
Definition nm_sendrecv_interface.h:278
a data descriptor, used to pack/unpack data from app layout to/from contiguous buffers
Definition nm_data.h:199