fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
at master 78 lines 2.6 kB view raw
1/***************************************************************************** 2 * pce * 3 *****************************************************************************/ 4 5/***************************************************************************** 6 * File name: src/devices/slip.h * 7 * Created: 2004-12-15 by Hampa Hug <hampa@hampa.ch> * 8 * Copyright: (C) 2004-2009 Hampa Hug <hampa@hampa.ch> * 9 *****************************************************************************/ 10 11/***************************************************************************** 12 * This program is free software. You can redistribute it and / or modify it * 13 * under the terms of the GNU General Public License version 2 as published * 14 * by the Free Software Foundation. * 15 * * 16 * This program is distributed in the hope that it will be useful, but * 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 * Public License for more details. * 20 *****************************************************************************/ 21 22 23#ifndef PCE_DEVICES_SLIP_H 24#define PCE_DEVICES_SLIP_H 1 25 26 27#define PCE_SLIP_BUF_MAX 4096 28 29 30/* a packet buffer */ 31typedef struct slip_buf_s { 32 struct slip_buf_s *next; 33 unsigned i; 34 unsigned n; 35 unsigned char buf[PCE_SLIP_BUF_MAX]; 36} slip_buf_t; 37 38 39typedef struct { 40 unsigned out_cnt; 41 unsigned char out[PCE_SLIP_BUF_MAX]; 42 char out_esc; 43 44 /* input packet queue */ 45 slip_buf_t *inp_hd; 46 slip_buf_t *inp_tl; 47 unsigned inp_cnt; 48 49 int tun_fd; 50 51 char checking; 52 53 void *get_uint8_ext; 54 int (*get_uint8) (void *ext, unsigned char *val); 55 56 void *set_uint8_ext; 57 int (*set_uint8) (void *ext, unsigned char val); 58} slip_t; 59 60 61void slip_init (slip_t *slip); 62void slip_free (slip_t *slip); 63 64slip_t *slip_new (void); 65void slip_del (slip_t *slip); 66 67void slip_set_set_uint8_fct (slip_t *slip, void *ext, void *fct); 68void slip_set_get_uint8_fct (slip_t *slip, void *ext, void *fct); 69 70int slip_set_tun (slip_t *slip, const char *name); 71 72void slip_uart_check_out (slip_t *slip, unsigned char val); 73void slip_uart_check_inp (slip_t *slip, unsigned char val); 74 75void slip_clock (slip_t *slip, unsigned n); 76 77 78#endif