(device string, snaplen int, pro int, timeout int)
| 298 | } |
| 299 | |
| 300 | func pcapOpenLive(device string, snaplen int, pro int, timeout int) (*Handle, error) { |
| 301 | err := LoadWinPCAP() |
| 302 | if err != nil { |
| 303 | return nil, err |
| 304 | } |
| 305 | |
| 306 | buf := make([]byte, errorBufferSize) |
| 307 | dev, err := syscall.BytePtrFromString(device) |
| 308 | if err != nil { |
| 309 | return nil, err |
| 310 | } |
| 311 | |
| 312 | cptr, _, _ := syscall.Syscall6(pcapOpenLivePtr, 5, uintptr(unsafe.Pointer(dev)), uintptr(snaplen), uintptr(pro), uintptr(timeout), uintptr(unsafe.Pointer(&buf[0])), 0) |
| 313 | |
| 314 | if cptr == 0 { |
| 315 | return nil, errors.New(byteSliceToString(buf)) |
| 316 | } |
| 317 | return &Handle{cptr: pcapTPtr(cptr)}, nil |
| 318 | } |
| 319 | |
| 320 | func openOffline(file string) (handle *Handle, err error) { |
| 321 | err = LoadWinPCAP() |
nothing calls this directly
no test coverage detected
searching dependent graphs…