自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(117)
  • 收藏
  • 关注

原创 正则表达式

元字符:在正则表达式中有特殊含义的字符,如:. ? ^ 行开头的位置 $ 行结束的位置 这两个只是匹配行中的位置,并不匹配任何字符。 当开启多行模式时,可以匹配多行 [] 匹配一个字符,此字符列在这里:如[ab]表示匹配一个字符,此字符是a或b 可以用-表示范围:如[0-2]等价于[012],[a-c]等价于[abc],[0-2a-c]等价于[012abc]

2015-06-18 10:36:14 706

翻译 rfc791 IP协议

简介目的在网络中,IP协议被用来从源主机向目的主机传送数据包。网络中的主机用固定长度的地址来标识。由于硬件限制,网络中只能通过有限大小的数据包,IP提供分片和重组功能来传输大的数据包。范围IP协议只提供传送数据所需的必要功能。至于可靠性,流量控制等功能都由上层协议提供。接口端对端协议调用IP协议,IP协议调用本机网络协议(如以太网协议)将数据包发送到目的主机或网关。 如:TCP模块要传输一个TCP

2015-05-18 09:39:54 3547 1

原创 lamp配置

[/opt/lampp/etc/extra/httpd-xampp.conf]## New XAMPP security concept#<LocationMatch ...> Require local ...</LocationMatch>当中的Require local改为Require all granted

2015-05-18 08:58:54 457

原创 ip_route_output_flow

[ip_route_output_flow]struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, struct sock *sk){ struct rtable *rt = __ip_route_output_key(net, flp4);[connect-

2015-04-23 16:59:41 3190

原创 SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)

[bind]SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen){ struct socket *sock; int err, fput_needed; sock = sockfd_lookup_light(fd, &err, &fput_needed);从文件fd中得到对应的

2015-04-21 15:19:12 783

原创 SYSCALL_DEFINE2(listen, int, fd, int, backlog)

[listen]SYSCALL_DEFINE2(listen, int, fd, int, backlog){ struct socket *sock; int err, fput_needed; int somaxconn; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (sock) { somaxconn =

2015-04-20 10:27:39 881 1

原创 int socket( int family, int type, int,protocol)

[net/socket.c]SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol){ int retval; struct socket *sock; int flags; flags = type & ~SOCK_TYPE_MASK; if (flags & ~(SOCK_CLOEXEC | SOCK_NON

2015-04-16 16:20:16 1070

原创 sock_init

[net/socket.c  ]static struct vfsmount *sock_mnt __read_mostly;可以把sock_mnt当作socket文件系统的虚拟挂载点。内核将socket实现为一个虚拟文件系统,和一般文件系统的不同之处在于它没有挂载点,不能通过mount命令进行挂载。/* the kern_mount function is called which “m

2015-04-15 09:19:42 1366

原创 socket-2

xx

2015-04-10 10:36:48 351

原创 I/O Models

There are five I/O models under Unix: 1. blocking I/O 2. nonblocking I/O 3. I/O multiplexing (select and poll) 4. signal driven I/O (SIGIO) 5. asynchronous I/O (the POSIX aio_functions) the

2015-04-10 10:12:12 508

原创 socket

在内核中,对socket实现了一种虚拟的文件系统(VFS):socketfs。和其它一般文件系统不同,它不能被mount,没有挂载点,而是通过一个静态变量来引用: [ net/socket.c ] static struct vfsmount *sock_mnt __read_mostly; 按照内核要求,定义一个结构来描述文件系统类型,然后在初始化时进行注册。 * 包含文件系统名字:sock

2015-04-08 10:48:13 1180

原创 Linux Netlink as an IP Services Protocol

Linux Netlink is used in Linux both as an intra-kernel messaging system as well as between kernel and user space.Netlink is a protocol between a Forwarding Engine Component (FEC) and a Control Pla

2015-03-09 10:52:23 938

原创 Netlink Sockets

The netlink socket interface( AF_NETLINK socket ) was created as a more flexible alternative to the awkward IOCTL communication method between userspace processes and the kernel. The IOCTL handlers ca

2015-03-05 13:10:48 448

原创 tcp-ip : sk_buff Structure

The sk_buff structure represents a packet. SKB stands for socket buffer. A packet can be generated by a local socket in the local machine, which was created by a userspace application; the packet can

2015-03-05 10:34:22 1153

原创 tcp-ip : net_device structure

The net_device struct represents the network device. It can be a physical device, like an Ethernet device, or it can be a software device, like a bridge device or a VLAN device.[include/linux/netdev

2015-03-04 15:56:50 1527

原创 gcc嵌入汇编

格式:__asm__ __volatile__ (汇编语句:  输出:  输入:  将要修改的寄存器);标志:“=”:输出“r”:任一通用寄存器“g”:让编译器决定如何装入它“0”~“9”:指定一个操作数,它既做输入又做输出命令:addl : 加法adcl : 带进位加法

2015-03-04 10:24:30 437

原创 tcp-ip : snmp

linux内核没有实现SNMP(SimpleNetwork Management Protocol,简单网络管理协议),只是收集一些MIB(管理信息基)并把它们输出到/proc去。[ include/uapi/linux/snmp.h ]/* tcp mib definitions *//* * RFC 1213: MIB-II TCP group * RFC 2012 (up

2015-03-03 10:28:03 1000

原创 tcp-ip : tcp2

TCP Timestamps Option(TSopt)TCP allow data to be sent at any time in either direction, and therefore timestamp echoing may occur in either direction. For simplicity, we specify that timestamps alway

2015-02-03 16:10:22 765

原创 tcp-ip : tcp接收数据

在ip层进行初始化时,对每种协议都会定义一个结构,并将其注册到全局列表。在IP层收到数据,要将其提交到上一层,这时,根据上层协议的类型从全局列表中找到对应的结构,然后调用其中的函数对数据进行处理:[ net/ipv4/af_inet.c ]static const struct net_protocol tcp_protocol = { .early_demux = tcp_v4_ear

2015-01-30 10:19:47 642

原创 tcp-ip TCP

The primary purpose of the TCP is to provide reliable, securable logical circuit or connection service between pairs of processes. To provide this service on top of a less reliable internet communicat

2015-01-23 10:11:05 687

原创 android studio 快捷键

Ctrl+E,可以显示最近编辑的文件列表Shift+Click可以关闭文件Ctrl+[或]可以跳到大括号的开头结尾Ctrl+Shift+Backspace可以跳转到上次编辑的地方Ctrl+F12,可以显示当前文件的结构Ctrl+F7可以查询当前元素在当前文件中的引用,然后按F3可以选择Ctrl+N,可以快速打开类Ctrl+Shift+N,可以快速打开文件Alt+Q可以看到当前方法的声明Ctrl+W

2015-01-16 23:07:04 318

原创 网络模块初始化-net成员

在net中有很多成员,这些都是全局量,它们的初始化在不同的函数进行实现:[ net/core/net_namespace.c ]static struct pernet_operations __net_initdata netdev_net_ops = { .init = netdev_init, .exit = netdev_exit,};/* Initialize pe

2015-01-16 10:11:03 1247

原创 网络模块初始化-packet_type

当设备接收到一个包,会从类型字段得到协议类型,如:IP,802.3,ARP,IPv6等。然后根据类型,调用不同的处理函数,这类似面向对象的操作通过下面的方式实现:定义一个结构,用来将类型和函数对应起来[ include/linux/netdevice.h ]struct packet_type { __be16 type; /* This is really htons(et

2015-01-14 16:44:51 1253

原创 网络模块初始化-proc

在内核启动时,会在/proc目录下为网络模块创建目录/proc/net和/proc/net/stat,这2个目录分别保存在net->proc_net和net->proc_net_stat,过程如下:[ init/main.c ]asmlinkage void __init start_kernel(void){...#ifdef CONFIG_PROC_FS proc_root_i

2015-01-12 15:44:42 572

原创 网络模块初始化-net( 网络名字空间 )

[ include/net/net_namespace.h ]Some of the currently global variables in the network stack need to have one instance per network namespace,or the global data structure needs to have a network name

2015-01-07 15:42:13 886

原创 tcp-ip IGMP: Internet Group Management Protocol

The Internet Group Management Protocol (IGMP) is used by hosts and routers that support multicasting. It lets all the systems on a physical network know which hosts currently belong to which multicast

2014-12-30 16:11:37 995

原创 tcp-ip UDP: User Datagram Protocol

The port numbers identify the sending process and the receiving process.The UDP length field is the length of the UDP header and the UDP data in bytes.The minimum value for this field is 8 bytes. (S

2014-12-30 11:17:07 718

原创 tcp-ip Ping Program

Most TCP/IP implementations support the Ping server directly in the kernel( the server is not a user process. )As with other ICMP query messages, the server must echo the identifier and sequence n

2014-12-26 16:52:08 465

原创 tcp-ip DNS

the Domain Name System (DNS) is a distributed database that provides the mapping between IP addresses and hostnames.

2014-12-26 16:48:31 582

原创 tcp-ip ICMP: Internet Control Message Protocol

ICMP is often considered part of the IP layer. It communicates error messages and other conditions that require attention.ICMP Message TypesICMP error messages are sometimes handled specially. For

2014-12-26 16:12:56 812

原创 tcp-ip ARP: Address Resolution Protocol

When an Ethernet frame is sent from one host on a LAN to another, it is the 48-bit Ethernet address that determines for which interface the frame is destined. The device driver software never looks at

2014-12-26 13:49:02 773

原创 tcp-ip IP Routing

Conceptually, IP routing is simple, especially for a host. If the destination is directly connected to the host (e.g., a point-to-point link) or on a shared network (e.g., Ethernet or token ring), the

2014-12-26 10:24:27 545

原创 tcp-ip IP( Internet Protocol )

IP provides an unreliable, connectionless datagram delivery service.By unreliable we mean there are no guarantees that an IP datagram successfully gets to its destination. When something goes wrong

2014-12-26 09:40:47 729

原创 tcp-ip MTU

There is a limit on the size of the frame for both Ethernet encapsulation and 802.3 encapsulation. This limits the number of bytes of data to 1500 and 1492, respectively. This characteristic of the li

2014-12-26 09:33:54 379

原创 tcp-ip Link Layer

The purpose of the link layer in the TCP/IP protocol suite is to send and receiveIP datagrams for the IP module, ARP requests and replies for the ARP module, andRARP requests and replies for the

2014-12-25 16:33:36 462

原创 tcp-ip Encapsulation

Each layer adds information to the data by prepending headers (and sometimes adding trailer information) to the data that it receives.The unit of data that TCP sends to IP is called a TCP segment. The

2014-12-25 14:45:53 644

原创 tcp-ip Port Numbers

TCP and UDP identify applications using 16-bit port numbers.Servers are normally known by their well-known port number.Those services that can be provided by any implementation of TCP/IP have well-k

2014-12-25 14:44:52 596

原创 tcp-ip Addresses

Every interface on an internet must have a unique Internet address (also called an IP address). These addresses are 32-bit numbers. Instead of using a flat address space such as 1, 2, 3, and so on, th

2014-12-25 14:43:10 447

原创 tcp-ip Introduction

Networking protocols are normally developed in layers, with each layer responsible for a different facet of the communications. A protocol suite, such as TCP/IP, is the combination of different protoc

2014-12-25 13:22:36 354

原创 代码

普通的iterator server and client

2014-12-09 16:54:49 312

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除