pcap_t * SendHandle;  // should be initialized with pcap_open_live

void CallBackPacketProc(u_char *args, const struct pcap_pkthdr *header,
const u_char *packet)

 u_char * TempPacket;

 TempPacket = (u_char *) malloc(header->caplen);
 memcpy(TempPacket, packet, header->caplen);

 pcap_sendpacket(SendHandle, TempPacket, header->caplen);

 free(TempPacket);
}


----- Original Message -----
From: "protocol 7" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 19, 2002 2:35 AM
Subject: [WinPcap-users] bridge program


> I'm writing a multi-homed ip/udp bridge program, and I've run across a
> pretty minor problem (I think) but i haven't been able to figure it out.
> What I'm doing is getting all ip/udp packets from the local network and
> editing the ip headers so I can send them to another system.  What I can't
> figure out is how to convert the packet (header and pkt_data structs) back
> into a char format (as pcap_sendpacket requires.)  any example code, or
> pointers to another program that is doing something similar would be very
> much appreciated.  FYI, my code is based on the udpdump example code, most
> modifications were to use the nonblocking read_ex call (so that
> pcap_sendpacket still has scope to the open pcap_t handle.)
> Thanks,
> Jason
>
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
>
> ==================================================================
>  This is the WinPcap users list. It is archived at
>  http://www.mail-archive.com/[email protected]/
>
>  To unsubscribe use
>  mailto: [EMAIL PROTECTED]?body=unsubscribe
> ==================================================================
>


==================================================================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/[email protected]/

 To unsubscribe use 
 mailto: [EMAIL PROTECTED]?body=unsubscribe
==================================================================

Reply via email to