145 |
|
|
146 |
/* Cisco ISL header */ |
/* Cisco ISL header */ |
147 |
typedef struct { |
typedef struct { |
148 |
m_uint16_t hsa1; /* High bits of source MAC address */ |
m_uint16_t hsa1; /* High bits of source MAC address */ |
149 |
m_uint8_t hsa2; /* (in theory: 0x00-00-0c) */ |
m_uint8_t hsa2; /* (in theory: 0x00-00-0c) */ |
150 |
m_uint16_t vlan; /* VLAN + BPDU */ |
m_uint16_t vlan; /* VLAN + BPDU */ |
151 |
m_uint16_t index; /* Index port of source */ |
m_uint16_t index; /* Index port of source */ |
152 |
m_uint16_t res; /* Reserved for TokenRing and FDDI */ |
m_uint16_t res; /* Reserved for TokenRing and FDDI */ |
153 |
} __attribute__ ((__packed__)) n_eth_isl_hdr_t; |
} __attribute__ ((__packed__)) n_eth_isl_hdr_t; |
154 |
|
|
155 |
#define N_ISL_HDR_SIZE (sizeof(n_eth_llc_hdr_t) + sizeof(n_eth_isl_hdr_t)) |
#define N_ISL_HDR_SIZE (sizeof(n_eth_llc_hdr_t) + sizeof(n_eth_isl_hdr_t)) |
156 |
|
|
157 |
|
/* Cisco SCP/RBCP header */ |
158 |
|
typedef struct { |
159 |
|
m_uint8_t sa; /* Source Address */ |
160 |
|
m_uint8_t da; /* Destination Address */ |
161 |
|
m_uint16_t len; /* Data Length */ |
162 |
|
m_uint8_t dsap; /* Destination Service Access Point */ |
163 |
|
m_uint8_t ssap; /* Source Service Access Point */ |
164 |
|
m_uint16_t opcode; /* Opcode */ |
165 |
|
m_uint16_t seqno; /* Sequence Number */ |
166 |
|
m_uint8_t flags; /* Flags: command/response */ |
167 |
|
m_uint8_t unk1; /* Unknown */ |
168 |
|
m_uint16_t unk2; /* Unknown */ |
169 |
|
m_uint16_t unk3; /* Unknown */ |
170 |
|
} __attribute__ ((__packed__)) n_scp_hdr_t; |
171 |
|
|
172 |
|
/* Check for a broadcast ethernet address */ |
173 |
|
static inline int eth_addr_is_bcast(n_eth_addr_t *addr) |
174 |
|
{ |
175 |
|
static const char *bcast_addr = "\xff\xff\xff\xff\xff\xff"; |
176 |
|
return(!memcmp(addr,bcast_addr,6)); |
177 |
|
|
178 |
|
} |
179 |
|
|
180 |
/* Check for a broadcast/multicast ethernet address */ |
/* Check for a broadcast/multicast ethernet address */ |
181 |
static inline int eth_addr_is_mcast(n_eth_addr_t *addr) |
static inline int eth_addr_is_mcast(n_eth_addr_t *addr) |
182 |
{ |
{ |
241 |
int udp_connect(int local_port,char *remote_host,int remote_port); |
int udp_connect(int local_port,char *remote_host,int remote_port); |
242 |
|
|
243 |
/* Listen on the specified port */ |
/* Listen on the specified port */ |
244 |
int ip_listen(int port,int sock_type,int max_fd,int fd_array[]); |
int ip_listen(char *ip_addr,int port,int sock_type,int max_fd,int fd_array[]); |
245 |
|
|
246 |
|
/* ISL rewrite */ |
247 |
|
void cisco_isl_rewrite(m_uint8_t *pkt,m_uint32_t tot_len); |
248 |
|
|
249 |
#endif |
#endif |