138a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin/*
239bac055674d23770b9a724221b728e443196ea7Elliott Hughes * Copyright (c) 2015-2017 The strace developers.
338a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * All rights reserved.
438a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin *
538a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * Redistribution and use in source and binary forms, with or without
638a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * modification, are permitted provided that the following conditions
738a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * are met:
838a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * 1. Redistributions of source code must retain the above copyright
938a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin *    notice, this list of conditions and the following disclaimer.
1038a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * 2. Redistributions in binary form must reproduce the above copyright
1138a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin *    notice, this list of conditions and the following disclaimer in the
1238a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin *    documentation and/or other materials provided with the distribution.
1338a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * 3. The name of the author may not be used to endorse or promote products
1438a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin *    derived from this software without specific prior written permission.
1538a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin *
1638a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1738a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1838a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1938a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2038a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2138a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2238a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2338a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2438a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2538a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2638a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin */
2738a34c9349267c99ce1ddbd0b6e985147415d355Dmitry V. Levin
287a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin#include "defs.h"
2977c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#include <netinet/in.h>
307a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin
3177c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#ifdef MCAST_JOIN_GROUP
327a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin
3377c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include DEF_MPERS_TYPE(struct_group_req)
3477c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughestypedef struct group_req struct_group_req;
357a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin
3677c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#endif /* MCAST_JOIN_GROUP */
377a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin
3877c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#include MPERS_DEFS
397a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin
4077c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#ifdef MCAST_JOIN_GROUP
417a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin
4277c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include "print_fields.h"
437a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin
4477c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott HughesMPERS_PRINTER_DECL(void, print_group_req, struct tcb *const tcp,
4577c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes		   const kernel_ulong_t addr, const int len)
4677c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes{
4777c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes	struct_group_req greq;
4877c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes
4977c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes	if (len < (int) sizeof(greq)) {
5077c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes		printaddr(addr);
5177c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes	} else if (!umove_or_printaddr(tcp, addr, &greq)) {
5277c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes		PRINT_FIELD_IFINDEX("{", greq, gr_interface);
5377c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes		PRINT_FIELD_SOCKADDR(", ", greq, gr_group);
5477c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes		tprints("}");
5577c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes	}
567a12974e9537c4ebaecada2a56f97dfa201f03dbDmitry V. Levin}
5777c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes
5877c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#endif /* MCAST_JOIN_GROUP */
59