xref: /netbsd-src/external/bsd/tcpdump/dist/missing/datalinks.c (revision c41df9f6167ea7cd2f761f0a97783c8267cb8847)
10f74e101Schristos /*
20f74e101Schristos  * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
30f74e101Schristos  *	The Regents of the University of California.  All rights reserved.
40f74e101Schristos  *
50f74e101Schristos  * Redistribution and use in source and binary forms, with or without
60f74e101Schristos  * modification, are permitted provided that the following conditions
70f74e101Schristos  * are met:
80f74e101Schristos  * 1. Redistributions of source code must retain the above copyright
90f74e101Schristos  *    notice, this list of conditions and the following disclaimer.
100f74e101Schristos  * 2. Redistributions in binary form must reproduce the above copyright
110f74e101Schristos  *    notice, this list of conditions and the following disclaimer in the
120f74e101Schristos  *    documentation and/or other materials provided with the distribution.
130f74e101Schristos  * 3. All advertising materials mentioning features or use of this software
140f74e101Schristos  *    must display the following acknowledgement:
150f74e101Schristos  *	This product includes software developed by the Computer Systems
160f74e101Schristos  *	Engineering Group at Lawrence Berkeley Laboratory.
170f74e101Schristos  * 4. Neither the name of the University nor of the Laboratory may be used
180f74e101Schristos  *    to endorse or promote products derived from this software without
190f74e101Schristos  *    specific prior written permission.
200f74e101Schristos  *
210f74e101Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
220f74e101Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
230f74e101Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
240f74e101Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
250f74e101Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
260f74e101Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
270f74e101Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
280f74e101Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
290f74e101Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
300f74e101Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
310f74e101Schristos  * SUCH DAMAGE.
320f74e101Schristos  */
330f74e101Schristos 
34*d881c474Schristos #include <config.h>
350f74e101Schristos 
36784088dfSchristos #include <netdissect-stdinc.h>
370f74e101Schristos 
380f74e101Schristos #include <pcap.h>
390f74e101Schristos #include <stdlib.h>
400f74e101Schristos #include <stdio.h>
410f74e101Schristos 
420f74e101Schristos #include "pcap-missing.h"
430f74e101Schristos 
440f74e101Schristos /*
450f74e101Schristos  * Stub versions for platforms that don't support them.
460f74e101Schristos  */
470f74e101Schristos int
480f74e101Schristos pcap_list_datalinks(pcap_t *p, int **dlt_buffer)
490f74e101Schristos {
500f74e101Schristos 	/*
510f74e101Schristos 	 * This platform doesn't support changing the DLT for an
520f74e101Schristos 	 * interface.  Return a list of DLTs containing only the
530f74e101Schristos 	 * DLT this device supports.
540f74e101Schristos 	 */
550f74e101Schristos 	*dlt_buffer = (int*)malloc(sizeof(**dlt_buffer));
560f74e101Schristos 	if (*dlt_buffer == NULL)
570f74e101Schristos 		return (-1);
580f74e101Schristos 	**dlt_buffer = pcap_datalink(p);
590f74e101Schristos 	return (1);
600f74e101Schristos }
61