2022年10月8日 星期六

Q.931 Called party number

Q.931 Channel Identification (ITU Q.931 section 4.5.8)
87654321Octet
IE ID: 0x70 1
Length2
ext.
1
Type of numberNumber plan identification3
0Number digits (IA5 characters)4
etc.
  • Type of number
  • Number plan identification
  • Number digits:IA5 (International Alphabet No. 5) 字元也就是 ITU-T Recommendation T.50,也就是 ASCII。

參考

2022年10月1日 星期六

syscall prctl()

process control

#include <sys/prctl.h>

int prctl(int option, unsigned long arg2, unsigned long arg3,
          unsigned long arg4, unsigned long arg5);

第一個引數決定要做什麼和定義後續引數怎麼用,可以是:

  • PR_CAP_AMBIENT (Linux 4.3+)
  • PR_CAPBSET_READ (Linux 2.6.25+)
  • PR_CAPBSET_DROP (Linux 2.6.25+)
  • PR_SET_CHILD_SUBREAPER (Linux 3.4+)
  • PR_GET_CHILD_SUBREAPER (Linux 3.4+)
  • PR_SET_DUMPABLE
  • PR_GET_DUMPABLE
  • PR_SET_KEEPCAPS
  • PR_GET_KEEPCAPS
  • PR_MCE_KILL (Linux 2.6.32+)
  • PR_MCE_KILL_GET (Linux 2.6.32+)
  • PR_SET_MM (Linux 3.3+)
  • PR_MPX_ENABLE_MANAGEMENT, PR_MPX_DISABLE_MANAGEMENT (since Linux 3.19+)
  • PR_SET_NAME (Linux 2.6.9+):設定自己 thread 名稱為 (char *)arg2,和 pthread_setname_np() 設定的、pthread_getname_np() 取得的屬性一樣,也可以透過 /proc/self/task/[tid]/comm 存取 (Linux 2.6.33+)。
  • PR_GET_NAME (Linux 2.6.11+):在 (char *)arg2 給 buffer 供回傳 thread 名稱字串,buffer 應該要有 16-byte 空間。
  • PR_SET_NO_NEW_PRIVS (Linux 3.5+)
  • PR_GET_NO_NEW_PRIVS (Linux 3.5+)
  • PR_SET_PDEATHSIG
  • PR_GET_PDEATHSIG
  • PR_SET_PTRACER (Linux 3.4+)
  • PR_SET_SECCOMP (Linux 2.6.23+)
  • PR_GET_SECCOMP (Linux 2.6.23+)
  • PR_SET_SECUREBITS (Linux 2.6.26+)
  • PR_GET_SECUREBITS (Linux 2.6.26+)
  • PR_GET_SPECULATION_CTRL (Linux 4.17+)
  • PR_SET_SPECULATION_CTRL (Linux 4.17+)
  • PR_SET_THP_DISABLE (Linux 3.15+)
  • PR_TASK_PERF_EVENTS_DISABLE (Linux 2.6.31+)
  • PR_TASK_PERF_EVENTS_ENABLE (Linux 2.6.31+)
  • PR_GET_THP_DISABLE (Linux 3.15+)
  • PR_GET_TID_ADDRESS (Linux 3.5+)
  • PR_SET_TIMERSLACK (Linux 2.6.28+)
  • PR_GET_TIMERSLACK (Linux 2.6.28+)
  • PR_SET_TIMING
  • PR_GET_TIMING
  • PR_SET_TSC (Linux 2.6.26+, x86 only)
  • PR_GET_TSC (Linux 2.6.26+, x86 only)
  • PR_SET_UNALIGN
  • PR_GET_UNALIGN

參考:man prctl

2022年9月23日 星期五

IPv6

Fragment

IPv6 基本上不做 Fragment,先透過 Path MTU Discovery 讓傳送端依照 MTU 送,就不需要 Fragment,所以標準 IPv6 封頭沒有 Fragmentation 支援。

透過 extension header,仍可以包含 fragmentation 資訊。

https://lirobo.blogspot.com/2022/09/internet-protocol.html

IPv4

16-bit Identification (ID)

  • 規定在特定來源位址、目的位址、和協定下,每個 datagram 要有不同值,但實際只用在 Fragmentation 和 Reassembly,Fragment 後沿用同樣 ID。其它有些實作並不改變 ID。
  • 在 maximum datagram lifetime (MDL) 內會有唯一的值,和建議的 reassembly timeout 有關,典型 MDL 是 2 分鐘 [RFC791] [RFC1122]。這樣限制了兩點間單一協定在典型 MTU 1500 時的速度上限為 6.4 Mbps [RFC4963],在高速裝置常會違反而變得沒有意義。
  • RFC1122 提到的 datagram de-duplication 用途,仍可以如同 IPv6 unfragmented datagrams 用 hash-based duplicate detection 達成 [RFC6621]。
  • 不改變 ID 導致如 RObust Header Compression (ROHC) [RFC5225] 支援。
  • 參考 RFC6864

3-bit Flags (0DM)

  • 0-bit:保留,沒用。
  • D-bit 表示 Do not Fragment (DF),不進行 Fragment。可用做 path MTU discovery。
  • M-bit 表示 More Fragments (MF)。Fragment 後沿用同樣 ID,除了最後封包外都設 M-bit。

13-bit Fragment Offset

  • IP Payload 的 Offset,採 8 的倍數。

IPv4 位址

https://lirobo.blogspot.com/2022/09/internet-protocol.html

https://lirobo.blogspot.com/2018/08/ipv4-and-ipv6-identification-and.html

https://lirobo.blogspot.com/2010/03/ipv4-link-local-addressing.html

https://lirobo.blogspot.com/2014/09/ether-type.html

2022年9月16日 星期五

Internet Protocol

IPv4

IPv6

https://lirobo.blogspot.com/2018/08/simple-history-of-ip-protocol_23.html

https://lirobo.blogspot.com/2018/08/ipv4-and-ipv6-identification-and.html

https://lirobo.blogspot.com/2020/03/ip-multicast.html

https://lirobo.blogspot.com/2010/10/ipsec.html

2022年9月10日 星期六

參數 (Parameter) vs. 引數 (Argument)

參數 (Parameter) 是函數的變數,宣告在函數的方法宣告。

引數 (Argument) 用來呼叫函數。

參考:https://notfalse.net/6/arg-vs-param

PWM 馬達調速電路

555 控制 PWM 馬達控制

https://www.circuits-diy.com/dc-motor-speed-control-circuit-using-555-timer-ic/

工作電壓:DC4.5-35V

輸出電流:0-5A

輸出功率:90W max.

靜態電流:7uA

PWM 占空比:1-100%

PWM 頻率:20kHz

https://www.circuits-diy.com/pwm-dc-motor-controller-using-ne555-timer-ic-electronics-project/ 

https://jin-hua.com.tw/webc/html/product/show.aspx?num=29768 (5-35V 或 3-15V)

SIP header Via

所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...