MCPcopy Create free account
hub / github.com/SamNet-dev/snix / Send

Function Send

platform/windows/windivert_api.go:137–153  ·  view source on GitHub ↗

Send writes packet pkt back to the stack using addr as the re-injection metadata. Returns bytes written.

(h handleRaw, pkt []byte, addr *Address)

Source from the content-addressed store, hash-verified

135// Send writes packet pkt back to the stack using addr as the re-injection
136// metadata. Returns bytes written.
137func Send(h handleRaw, pkt []byte, addr *Address) (uint32, error) {
138 if len(pkt) == 0 {
139 return 0, fmt.Errorf("send: empty packet")
140 }
141 var sentLen uint32
142 r1, _, e1 := procWinDivertSend.Call(
143 uintptr(h),
144 uintptr(unsafe.Pointer(&pkt[0])),
145 uintptr(uint32(len(pkt))),
146 uintptr(unsafe.Pointer(&sentLen)),
147 uintptr(unsafe.Pointer(addr)),
148 )
149 if r1 == 0 {
150 return 0, fmt.Errorf("WinDivertSend: %w", translateErr(e1))
151 }
152 return sentLen, nil
153}
154
155// Close unloads the WinDivert handle.
156func Close(h handleRaw) error {

Callers 2

recvLoopMethod · 0.85
InjectMethod · 0.85

Calls 1

translateErrFunction · 0.85

Tested by

no test coverage detected