EmbLogic's Blog

FTP Protocol

The design objectives of FTP were as follows:

1. To promote sharing of files (computer programs or data).
2 To encourage indirect or implicit use of remote computers (i.e. to be a network based application that can be readily employed).
3. To shield a user from variations in file storage systems among hosts.
4. To transfer data reliably and efficiently.

FTP provides a means of transferring a file between two computers, however, most FTP clients also permit the user to navigate the file system, create/delete directories/files (if permitted) on both the local and connected machines, etc.

The FTP client consists of a User Protocol Interpreter (PI) that initiates a connection with the
Server Protocol Interpreter (using port 21). The user PI sends FTP commands to the server PI,which in turn replies back to the user PI.
The user and server data transfer processes (operating on port 20) are usedto transfer data between the client and server.

In the model  the user-protocol interpreter initiates the control connection. The control connection follows the Telnet protocol. At the initiation of the user, standard FTP commands are generated by the user-PI and transmitted to the server process via the control connection.Standard replies are sent from the server-PI tothe user-PI over the control connection in response to the commands.

The FTP commands specify the parameters for the data connection (data port, transfer mode, representation type, and structure) and the nature of file system operation (store, retrieve, append, delete, etc.). The user-DTP or its designate should “listen” on the specified data port, and the server initiate the data connection and data transfer in accordance with the specified parameters. It should be noted that the data port need not be in the same host that initiates the FTP commands via the control connection, but the user or the user-FTP process must ensure a “listen” on the specified data port. It ought to also be noted that the data connection may be used for simultaneous sending and receiving.

In another situation a user might wish to transfer files between two hosts, neither of which is a local host.The user sets up control connections to the two servers and then arranges for a data connection between them. In this manner, control information is passed to the user-PI but data is transferred between the server data transfer processes. Following is a model of this server-server interaction.

The protocol requires that the control connections be open while data transfer is in progress. It is the responsibility of the user to request the closing of the control connections when finished using the FTP service, while it is the server who takes the action. The server may abort data transfer if the control connec-tions are closed without command.

Posted in Uncategorized | Leave a comment

File Transfer Protocol

File Transfer Protocol (FTP) is a standard network protocol used for transferring files from one computer to another. It is the preferred method of exchanging files because it’s faster than other protocols like HTTP.

FTP operates on the application layer of the OSI model, and is used to transfer files using TCP/IP. For the data transfer, FTP server needs to be waiting for incoming requests. The client computer is then able to communicate with the server on port no. 21. Actually, there are two types of connection i.e. Control connection & Data Connection.

First, the control connection is used for session administration (i.e., commands, identification, passwords) exchanged between the client and server by port no 21. Then, the server responds on the control connection with three digit status codes in ASCII with an optional text message, for example “200″ (or “200 OK.”) means that the last command was successful. The numbers represent the code number and the optional text represent explanations (e.g. <OK>). At last,that the data connection is established by port no. 20.

FTP can be run in two modes i.e. active or passive mode. In active mode, the client sends the server the IP address and port number on which the client will listen, and the server initiates the TCP connection. In situations where the client is behind a firewall and unable to accept incoming TCP connections, passive mode may be used. In this mode the client sends a PASV command to the server and receives an IP address and port number in return. The client uses these to open the data connection to the server.

Posted in Uncategorized | Leave a comment

File Transfer Protocol

File Transfer Protocol uses two TCP ports,one for control and one for data transfer.It transfer Files in a Heterogeneous Host Environment. it has two modes -
1)Active mode FTP :=Client connect from a random unprivileged port (n > 1023) to the server command port (21) and sends port command to tell server to connect to n+1 port. The server connects from it’s data port (20) to the client data port (n+1) .

2)Passive mode FTP := Client opens two random unprivileged ports ( n > 1023 and n+1; ex 1026 and 1027) and connects the first port (n) to server command port 21 and issues a pasv command ; client connects to servers specified data port, server completes connection.

Data is transmitted as streams,block or in compressed form..Data transmission depends upon following factors like frequency, bandwidth, size of packet and network traffic..

While transferring data over the network, four data representations can be used:-
1) ASCII mode: used for text. Data is converted, if needed, from the sending host’s character representation to “8-bit ASCII” before transmission, and (again, if necessary) to the receiving host’s character representation. As a consequence, this mode is inappropriate for files that contain data other than plain text.

2) Image mode (commonly called Binary mode): the sending machine sends each file byte for byte, and the recipient stores the bytestream as it receives it.

3)EBCDIC mode: use for plain text between hosts using the EBCDIC character set. This mode is otherwise like ASCII mode.

4)Local mode: Allows two computers with identical setups to send data in a proprietary format without the need to convert it to ASCII.

Posted in Uncategorized | Leave a comment

FILE TRANSFER PROTOCOL

FTP:-
File Transfer Protocol is a network protocol used to transfer(copy) file from one host to another using Tcp/ip network . It is basically based on client server architecture model. It has 2 basic lines between the clint and server . One is called as Control line and another is Data line . Control line is used for the authentication . first this protocol authenticate the user by userneme and password through the control line by port no.21 . The second connection calld as Data connection opened then on port 20 . The data connection is used in 2 modes active and passive.If a firewall is existed then is used it passively. passively means that a new ip+port generated by the server to the client which used by server but its not client’s actual ip+port.In passive mode we use the command PASV to establish connection . In active mode simply the server gets the client’s ip+port for the file transfer.

when we authenticate the server request then server respond wth a three digit code to tell that your (client’s) last command was successfull then data line gets the control .Then file transfer in progress over the data connection. File transfer can be interrupted by sending a interrupt on the control line . The transfer rate of this protocol depends on the freq.,size of packts (transferring), bandwidth and traffic on the network.

Posted in Uncategorized | Leave a comment

Interrupt handler

The role of an interrupt handler is to give feedback to its device about interrupt
reception and to read or write data according to the meaning of the interrupt being
serviced. The first step usually consists of clearing a bit on the interface board; most
hardware devices won’t generate other interrupts until their “interrupt-pending” bit
has been cleared. Depending on how your hardware works, this step may need to be
performed last instead of first; there is no catch-all rule here. Some devices don’t
require this step, because they don’t have an “interrupt-pending” bit; such devices
are a minority.

Posted in Uncategorized | Leave a comment

Blocking I/O

A call to read may come when no data is available, but more is expected in the future. Or a process could attempt to write, but your device is not ready to accept the data, because your output buffer is full. The calling process usually does not care about such issues; the programmer simply expects to call read or write and have the call return after the necessary work has been done. So, in such cases, your driver should (by default) block the process,
putting it to sleep until the request can proceed.

Posted in Uncategorized | Leave a comment

Interrupt Disabling

However, interrupt disabling alone does not always prevent kernel control path interleaving.
Indeed, a kernel control path could raise a “Page fault” exception, which in turn could suspend the current process (and thus the corresponding kernel control path). Or again, a kernelcontrol path could directly invoke the schedule( ) function. This happens during most I/O disk operations because they are potentially blocking, that is, they may force the process to sleep until the I/O operation completes. Therefore, the kernel must never execute a blocking operation when interrupts are disabled, since the system could freeze.

Posted in Uncategorized | Leave a comment

Interrupt Disabling

For any section of code too large to be defined as an atomic operation, more complicated
means of providing critical sections are needed. To ensure that no window is left open for a
race condition to slip in, even a window one instruction long, these critical sections always
have an atomic operation at their base.
Interrupt disabling is one of the key mechanisms used to ensure that a sequence of kernel
statements is operated as a critical section. It allows a kernel control path to continue
executing even when hardware devices issue IRQ signals, thus providing an effective way to
protect data structures that are also accessed by interrupt handlers.

Posted in Uncategorized | Leave a comment

Atomic Operations

The easiest way to prevent race conditions is by ensuring that an operation is atomic at the chip level: the operation must be executed in a single instruction. These very small atomic operations can be found at the base of other, more flexible mechanisms to create critical sections. Thus, an atomic operation is something that can be performed by executing a single assembly language instruction in an “atomic” way, that is, without being interrupted in the middle.

Posted in Uncategorized | Leave a comment

A race condition can occur when the outcome of some computation depends on how two or more interleaved kernel control paths are nested. A critical region is any section of code that should be completely executed by each kernel control path that begins it, before another kernel control path can enter it.
Here are four broad types of synchronization techniques:

  • Nonpreemptability of processes in Kernel Mode.
  • Atomic operations
  • Interrupt disabling.
  • Locking.
Posted in Uncategorized | Leave a comment

Nonpreemptability of Processes in Kernel Mode

Linux kernel is not preemptive, that is, a running process cannot
be preempted (replaced by a higher-priority process) while it remains in Kernel Mode. In
particular, the following assertions always hold in Linux:

  • No process running in Kernel Mode may be replaced by another process, except when the former voluntarily relinquishes control of the CPU.
  • Interrupt or exception handling can interrupt a process running in Kernel Mode
    however, when the interrupt handler terminates, the kernel control path of the process is resumed.
Posted in Uncategorized | Leave a comment

Platform Driver !!

Driver Model (USB,I2C) enumerate device and bind it with driver .USB and PCI are hotplugged device and they have capability to notify OS when lets say USB (pendrive )attach.But in SOC’s based , a lot of inbuilt peripherals like host controller(eg i2c HC) these inbuilt devices are not capable to inform the OS that they are present. So the kernel/drivers developers built similar model like hot pluggable devices so they invented platform drivers model.

Posted in Uncategorized | 1 Comment

Kmalloc failed to allocate ?

Lets say we have device mobile and we start an application ,our application connects to our driver and in driver level lets say we allocate some memory using kmalloc with flag=GFP_KERNEL ,now if memory allocation fail in each time so what will be our application behaviour,will it run or will crash ,how memory issue will resolve and what are the likely cause of failure? Secondly ,if I put into different way like suppose ,I use kmalloc in ISR then again lets say our memory allocation fail (with some reason) then what are the issues we have to address and Will our application crash or we just flash “memory fail switch off your mobile ….”

1 Comment

PCI

The CPU and the PCI devices need to access memory that is shared between them. This memory is used by device drivers to control the PCI devices and to pass information between them. Typically the shared memory contains control and status registers for the device. These registers are used to control the device and to read its status. For example, the PCI SCSI device driver would read its status register to find out if the SCSI device was ready to write a block of information to the SCSI disk. Or it might write to the control register to start the device running after it has been turned on.

Posted in Uncategorized | Leave a comment

SPI

The Serial Peripheral Interface (SPI) bus is a serial master-slave interface similar to I 2C and comes built in on many microcontrollers. It uses four wires (compared to two on I2C): Serial CLocK (SCLK), Chip Select (CS),Master Out Slave In (MOSI), and Master In Slave Out (MISO). MOSI is used for shifting data into the slave device, and MISO is used for shifting data out of the slave device. Because the SPI bus has dedicated wires for transmitting and receiving data, it can operate in full-duplex mode, unlike the I 2C bus. The typical speed of
operation of SPI is in the low-megahertz range, unlike the mid-kilohertz range on I2C, so the former yields higher throughput.

Posted in Uncategorized | Leave a comment