USE [UILogDB]
GO
/****** Object: UserDefinedFunction [dbo].[ipStringToBigInt] Script Date: 11/09/2011 09:47:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[ipStringToBigInt] ( @ip CHAR(15) )
RETURNS bigint
AS
BEGIN
DECLARE @rv bigint, @o1 bigint, @o2 INT, @o3 INT, @o4 INT
if (isnumeric(replace(@ip,'.',''))<>0)
begin
SELECT @o1 = CONVERT(INT, PARSENAME(@ip, 4)), @o2 = CONVERT(INT, PARSENAME(@ip, 3)), @o3 = CONVERT(INT, PARSENAME(@ip, 2)), @o4 = CONVERT(INT, PARSENAME(@ip, 1))
IF (@o1 BETWEEN 0 AND 255) AND (@o2 BETWEEN 0 AND 255) AND (@o3 BETWEEN 0 AND 255) AND (@o4 BETWEEN 0 AND 255)
BEGIN
SET @rv = (@o1 * 16777216) + (@o2 * 65536) + (@o3 * 256) + (@o4)
END
ELSE
SET @rv = 0 RETURN @rv
end
else
SET @rv = 0 RETURN @rv
END
分享到:
相关推荐
if ((((intIP >= IpToInt("0.0.0.0")) && (intIP <= IpToInt("2.255.255.255"))) || ((intIP >= IpToInt("64.0.0.0")) && (intIP <= IpToInt("126.255.255.255")))) || ((intIP >= IpToInt("58.0.0.0")) && ...
int PowerMode(byteint A,byteint C,byteint D,signed char flag[400]);//computing A^B mod C-->D void IntRandom(byteint RandomA,int num); //随机产生一个大数 void LoadInt(byteint A,mtype B); //将质数...
int main(int argc, char **argv) { WSADATA wsd; SOCKET s; BOOL bOpt; struct sockaddr_in remote; IP_HDR ipHdr; UDP_HDR udpHdr; int ret; DWORD i; unsigned short iTotalSize, ...
UINT m_port_to; void RemoveClient(CFtpdPi *pBind); void AddClient(CFtpdPi* pBind); UINT m_port; DWORD* lpDW2; DWORD* lpDW; LPHOSTENT lpHostEnt; char HostName[100]; unsigned long IP; char ...
int sendudp(char *srcip, char *dstip, int srcprt, int dstprt, char *buf, int bufsize) { WSADATA wsd; SOCKET s; char sendbuf[1000]={0}; int iphdrlen, allsize, udphdrlen; int optlevel, option, ...
int IP_Table[64] = { 57,49,41,33,25,17,9,1, 59,51,43,35,27,19,11,3, 61,53,45,37,29,21,13,5, 63,55,47,39,31,23,15,7, 56,48,40,32,24,16,8,0, 58,50,42,34,26,18,10,2, 60,52,44,36,28,20,12,4, ...
int decode_resp(char *buf, int bytes,struct sockaddr_in *from) { IpHeader *iphdr; IcmpHeader *icmphdr; unsigned short iphdrlen; iphdr = (IpHeader *)buf; iphdrlen = (iphdr->h_len) * 4 ; // number ...
int getIpForHost(const char *host, struct sockaddr_in *ip) { struct hostent *he; struct in_addr **addr_list; he=gethostbyname(host); if (he==NULL) return 0; addr_list=(struct in_addr **)he->h_...
bool GetLocalIP(char* ip) { char szText[256]; //获取本机主机名称 int iRet; iRet = gethostname(szText,256); int a = WSAGetLastError(); if (iRet!=0) { printf("gethostname() Failed!"); return ...
// This sets my IP address to 192.168.0.168 unsigned long code my_ipaddr = 0xC0A800A8L; // This sets my subnet mask to 255.255.255.0 unsigned long code my_subnet = 0xFFFFFF00L; // Set to 0 if no ...
自己定义的ip地址控件,好用 #include "stdafx.h" #include "IPTest.h" #include "IPTestDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ////////////...
auto main ( int , char const **) -> int { // Convert from a string... auto ip = ip::IPv4::from_string ( " 127.0.0.1 " ); // Explicitly convertible to a uint32_t (host byte order)... auto ip_val = ...
问题描述: 现给定两个IPv4地址,和一个子网掩码,判断是否属于同一个子网,若属于,输出1,否则输出0。 例如输入: 172.16.1.3 172.16.1.35 ...int _to_int(char * str, int start_idx, int end_i
int main(int argc,char* argv[]){ pcap_if_t *alldevs; //全部网卡列表 pcap_if_t *d; //一个网卡 int inum; //用户选择的网卡序号 int i=0; //循环变量 pcap_t *adhandle; //一个pcap实例 char errbuf[PCAP_...
unsigned int sourceIP; unsigned int destIP; }IpHeader; typedef struct icmphdr { BYTE type; BYTE code; USHORT checksum; USHORT id; USHORT seg; }IcmpHeader; #define ICMP_RCHO 8 #define ICMP_...
void query(char *EndPointURL,char *NameSpace,char *method,int argv_len,char* args[],char* argv[]) { ISoapSerializerPtr Serializer; ISoapReaderPtr Reader; ISoapConnectorPtr Connector; // ...
int main (int argc, char *argv[]) { GeoIP * gi; gi = GeoIP_new(GEOIP_STANDARD); printf("code %s\n", GeoIP_country_code_by_name(gi, "yahoo.com")); } To compile this example, run gcc -lGeoIP ...
* MONARCH wants to know if the MAC layer is passing this back because * it could not get the RTS through or because it did not receive * an ACK. */ int xmit_reason_; #define XMIT_REASON_RTS 0x01 ...
int IP1[]={58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, //initial change 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, ...
int IP1[]={58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, //initial change 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, ...