2012年3月30日 星期五

SSL Programming

[Reference]
http://www.openssl.org/docs/ssl/ssl.html
http://daydreamer.idv.tw/rewrite.php/read-62.html
http://h71000.www7.hp.com/doc/83final/ba554_90007/ch04s03.html
http://www.ibm.com/developerworks/cn/linux/l-openssl.html
http://blog.csdn.net/playmud/article/details/1527438
http://www.rtfm.com/openssl-examples/part1.pdf

struct socket & struct sock 分析

User space application 透過下列函式的調用取得 socket descriptor

int socket(int domain, int type, int protocol); 

在system call中,這個sockfd就會被映射成一個表示socket的struct
下面是其完整定義

struct socket {
    socket_state state;
    unsigned long flags;
    const struct proto_ops *ops;
    struct fasync_struct *fasync_list;
    struct file *file;
    struct sock *sk;
    wait_queue_head_t wait;
    short type;
}; 


state用於表示socket所處的狀態,不過此成員只對TCP socket有用
因為TCP是connection-oriented的protocol,需要維護socket狀態



[Reference] http://miox.cc/2009/05/struct-socket.html

2012年3月28日 星期三

New API (NAPI)

NAPI 是設計用來增進高速網路的效能。
原本網路封包是利用中斷機制通知核心來收取封包,
但在高速網路下,大量的中斷反而會吃掉大量的CPU運算資源來做context switch

[Reference]
http://lwn.net/Articles/30107/

2012年3月27日 星期二

Linux 等待佇列(Wait queue)機制原理分析




[Reference]
http://blog.chinaunix.net/space.php?uid=20643761&do=blog&id=1594859

select函數實現原理分析







[Reference]
http://blog.chinaunix.net/space.php?uid=20643761&do=blog&id=1594860