当前位置: 首页>>代码示例>>Golang>>正文


Golang C.sfsistat函数代码示例

本文整理汇总了Golang中C.sfsistat函数的典型用法代码示例。如果您正苦于以下问题:Golang sfsistat函数的具体用法?Golang sfsistat怎么用?Golang sfsistat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sfsistat函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Go_xxfi_connect

//export Go_xxfi_connect
func Go_xxfi_connect(ctx *C.SMFICTX, hostname *C.char, hostaddr *C._SOCK_ADDR) C.sfsistat {
	ctxptr := ctx2int(ctx)
	var ip net.IP

	if hostaddr.sa_family == C.AF_INET {
		hostaddrin := (*sockaddr_in)(unsafe.Pointer(hostaddr))
		ip_addr := make([]byte, 4)
		binary.LittleEndian.PutUint32(ip_addr, hostaddrin.sin_addr)
		ip = net.IPv4(ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3])

	} else if hostaddr.sa_family == C.AF_INET6 {
		sa_in := (*C.struct_sockaddr_in6)(unsafe.Pointer(hostaddr))
		ip = net.IP(C.GoBytes(unsafe.Pointer(&sa_in.sin6_addr), 16))
	} else {
		if milter.GetDebug() {
			logger.Println("hostaddr.sa_family value not implemented")
		}
		ip = net.ParseIP("::")
	}

	m := milter.(checkForConnect)
	code := m.Connect(ctxptr, C.GoString(hostname), ip)
	if milter.GetDebug() {
		logger.Printf("Connect callback returned: %d\n", code)
	}
	return C.sfsistat(code)
}
开发者ID:rayyang2000,项目名称:gomilter,代码行数:28,代码来源:gomilter.go

示例2: Go_xxfi_header

//export Go_xxfi_header
func Go_xxfi_header(ctx *C.SMFICTX, headerf, headerv *C.char) C.sfsistat {
	m := milter.(checkForHeader)
	code := m.Header(ctx2int(ctx), C.GoString(headerf), C.GoString(headerv))
	if milter.GetDebug() {
		logger.Printf("Header callback returned: %d\n", code)
	}
	return C.sfsistat(code)
}
开发者ID:rayyang2000,项目名称:gomilter,代码行数:9,代码来源:gomilter.go

示例3: Go_xxfi_helo

//export Go_xxfi_helo
func Go_xxfi_helo(ctx *C.SMFICTX, helohost *C.char) C.sfsistat {
	m := milter.(checkForHelo)
	code := m.Helo(ctx2int(ctx), C.GoString(helohost))
	if milter.GetDebug() {
		LoggerPrintf("Helo callback returned: %d\n", code)
	}
	return C.sfsistat(code)
}
开发者ID:davrux,项目名称:gomilter,代码行数:9,代码来源:gomilter.go

示例4: Go_xxfi_close

//export Go_xxfi_close
func Go_xxfi_close(ctx *C.SMFICTX) C.sfsistat {
	// Call our application's callback
	m := milter.(checkForClose)
	code := m.Close(ctx2int(ctx))
	if milter.GetDebug() {
		logger.Printf("Close callback returned: %d\n", code)
	}
	return C.sfsistat(code)
}
开发者ID:rayyang2000,项目名称:gomilter,代码行数:10,代码来源:gomilter.go

示例5: Go_xxfi_envrcpt

//export Go_xxfi_envrcpt
func Go_xxfi_envrcpt(ctx *C.SMFICTX, argv **C.char) C.sfsistat {
	// Call our application's callback
	m := milter.(checkForEnvRcpt)
	code := m.EnvRcpt(ctx2int(ctx), cStringArrayToSlice(argv))
	if milter.GetDebug() {
		logger.Printf("EnvRcpt callback returned: %d\n", code)
	}
	return C.sfsistat(code)
}
开发者ID:rayyang2000,项目名称:gomilter,代码行数:10,代码来源:gomilter.go

示例6: Go_xxfi_abort

//export Go_xxfi_abort
func Go_xxfi_abort(ctx *C.SMFICTX) C.sfsistat {
	// Call our application's callback
	m := milter.(checkForAbort)
	code := m.Abort(ctx2int(ctx))
	if milter.GetDebug() {
		LoggerPrintf("Abort callback returned: %d\n", code)
	}
	return C.sfsistat(code)
}
开发者ID:davrux,项目名称:gomilter,代码行数:10,代码来源:gomilter.go

示例7: Go_xxfi_body

//export Go_xxfi_body
func Go_xxfi_body(ctx *C.SMFICTX, bodyp *C.uchar, bodylen C.size_t) C.sfsistat {
	// Create a byte slice from the body pointer.
	// The body pointer just points to a sequence of bytes
	// Our bit slice is backed by the original body. No copy is made here
	// Be aware that converting the byte slice to string will make a copy
	var b []byte
	b = (*[1 << 30]byte)(unsafe.Pointer(bodyp))[0:bodylen]
	// Call our application's callback
	m := milter.(checkForBody)
	code := m.Body(ctx2int(ctx), b)
	if milter.GetDebug() {
		logger.Printf("Body callback returned: %d\n", code)
	}
	return C.sfsistat(code)
}
开发者ID:rayyang2000,项目名称:gomilter,代码行数:16,代码来源:gomilter.go


注:本文中的C.sfsistat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。