public BerkeleyPacketFilter(string filterValue, int snapshotLength, DataLinkKind kind, IpV4SocketAddress netmask) { this.Initialize(filterValue, snapshotLength, kind, netmask); }
private unsafe void Initialize(pcap *pcapDescriptor, string filterString, IpV4SocketAddress netmask) { // ISSUE: untyped stack allocation long num1 = (long)__untypedstackalloc(\u003CModule\u003E.__CxxQueryExceptionSize()); basic_string\u003Cchar\u002Cstd\u003A\u003Achar_traits\u003Cchar\u003E\u002Cstd\u003A\u003Aallocator\u003Cchar\u003E\u0020\u003E stdAllocatorChar; MarshalingServices.ManagedToUnmanagedString(&stdAllocatorChar, filterString); // ISSUE: fault handler try { uint num2 = 0U; if (netmask != null) { num2 = netmask.Address.ToValue(); } bpf_program *bpfProgramPtr1 = (bpf_program *)\u003CModule\u003E.@new(16UL); bpf_program *bpfProgramPtr2; if ((IntPtr)bpfProgramPtr1 != IntPtr.Zero) { // ISSUE: initblk instruction __memset((IntPtr)bpfProgramPtr1, 0, 16L); bpfProgramPtr2 = bpfProgramPtr1; } else { bpfProgramPtr2 = (bpf_program *)0; } this._bpf = bpfProgramPtr2; try { if (\u003CModule\u003E.pcap_compile(pcapDescriptor, this._bpf, \u003CModule\u003E.std\u002Ebasic_string\u003Cchar\u002Cstd\u003A\u003Achar_traits\u003Cchar\u003E\u002Cstd\u003A\u003Aallocator\u003Cchar\u003E\u0020\u003E\u002Ec_str(&stdAllocatorChar), 1, num2) < 0) { throw new ArgumentException("An error has occured when compiling the filter <" + filterString + ">: " + PcapError.GetErrorMessage(pcapDescriptor)); } } catch (Exception ex1) when( { // ISSUE: unable to correctly present filter uint num3 = (uint)Marshal.GetExceptionCode(); if (\u003CModule\u003E.__CxxExceptionFilter((void *)Marshal.GetExceptionPointers(), (void *)0, 0, (void *)0) != 0) { SuccessfulFiltering; } else { throw; } } ) { uint num4 = 0U; \u003CModule\u003E.__CxxRegisterExceptionObject((void *)Marshal.GetExceptionPointers(), (void *)num1); try { try { \u003CModule\u003E.delete((void *)this._bpf); \u003CModule\u003E._CxxThrowException((void *)0, (_s__ThrowInfo *)0); } catch (Exception ex2) when( { // ISSUE: unable to correctly present filter num4 = (uint)\u003CModule\u003E.__CxxDetectRethrow((void *)Marshal.GetExceptionPointers()); if ((int)num4 != 0) { SuccessfulFiltering; } else { throw; } } ) { } if ((int)num4 != 0) { throw; } }
internal unsafe BerkeleyPacketFilter(pcap *pcapDescriptor, string filterString, IpV4SocketAddress netmask) { this.Initialize(pcapDescriptor, filterString, netmask); }