Most important stuff? Flashcards
absolute URL
link to different domain
relative URL
link to same domain
HTTP request components
protocol
domain name
port number
file path
DOC flow block
top to bottom expands full width
DOC flow inline
left to right width fits content
3 paradigms Javascript supports
OOP
imperative
functional
cookies store info on
client side
CSS applied 3 ways
inline (in tags)
internally (in style tag)
external style sheets
what 4 elements not inherited
width
margin
padding
border
JS can do what to do the DOM
access and manipulate
event handlers are
JS functions linked to DOM elements events
event handlers vs event listeners
callbacks
elements
asynchronous data fetching
data downloading
fetching data asynchronously enables real time updates and smoother user experiences
REST Api
representational state transfer
application programming interface that conforms to design principles of REST arch style
web frameworks
simplify development of web applications
call your code
client and back side Web frameworks
client side
JS
CSS
HTML
backend
web service APIs
databases
interactive content
page responds to user actions
dynamic content
generated, custom for each user
why is DOM manipulation a problem
complexity of manipulating thousands of elements
traditional doesn’t inherently synchronise data changing across view boards
one way data binding
updates DOM base on data model
2 way data binding
automatically synchronises the model and the view
react
front end library focused on building user interfaces of web apps
isolates differences in VDOM then only updates DOM with differences to increase performance
3 main points of web frameworks
1) help with performance (instead of individual manipulation to DOM elements)
2) 2 way data binding ensures model and view consistency
3) help to develop complex applications
relational vs non relational databases
relational
rigid
based on structured schema organised into table
vertical scale
non relatiinal
flexible
document based on key value
priorities availability
horizontal scale
db normalisation
removing redundancies which improves consistency of data
3 types of ER diagrams
chen
crow feet
UML
DB transactions exhibit ____
ACID
atomic
consistent
isolated
durable
DB concurrency achieved through
2 phase locking
acquire locks in one phase and releases in another
deadlock handling
occurs when transactions wait indefinitely for each other to release locks
multi value attributes
double circles
derived attribute
dotted line
weak entity vs normal entity
2 lines around
normal just one line
weak is when has no attributes of own
total participation vs optional participation
double lines
one line
SQL
declarative
client vs server
client: equests resources or services
server: provides resources or services
thin vs thick client
thin is dumb and provides basic input output only and servers provide storage and processing
thick is rich and fat
uses own storage and processing and can continue without server
DHCP
automates IP ad assignment and configuration
DHCP server, client and lease
server holds pool of IP ad and assigns them to clients
client device that requests IP ad from DHCP
lease is time for which IP is valid
connecting to wifi DORA
discovery
client broadcasts request for IP ad to DHCP server
Offer
DHCP server responds with IP ad and network configuration
Request
client accepts offer and requests to use the offered IP
Acknowedgemant
DHCP confirms IP assignment and connects client to wifi
DNS
domain name systen
system used to translate human readable domiain names like www.google.com into IP address
like a phone book
IP address
set of 4 numbers from 0-255
DNS server
severs that translate DN into IP address
DNS resolution 6 steps
1) query user enters domain name in browser
2) local DNS resolver checks cache if not found forwards query to root DNS server
3) root DNS server directs to appropriate TLD server
4) TLD server points to authoritative DNS server for specific domain
5) authoritative DNS server provides IP address associated with requested DN
6) response, client now has IP ad and browser can connect to web server using IP ad
web applications 3 tier architecture
web server
static content
application server
dynamic
database server
data management
web server get vs post request
get
used to request resources, page fetching
post
used to send data to the server, resource fetching
HTTP request must include
URL to identify web server and resource
URL has the following info
protocol
domain
port
resource path
web server main purposes
fetch and responds to client request through get and post methods
path routing
security
compression
caching
logging
node js
js runtime that allows server side scripting
distributed web services pros and cons (CAP)
pros
increased avaliability
closer servers to client increased performance
cons
want sited to be but CAP theorem states can only have 2
Consistent
Available
Partition tolerance
web services enable
enable machine o machine interaction over network allowing diff apps to communicate and share data
web service APIs provide
HTTP interface
databases don’t speak HTTp but web services can speak both sql and http
HTTP header for request vs response
request
accept
if mod since
if match
cookies
authorization
response
last mod
ETag
set cookie
location (redirect URL)
express
web server framework for node.js that simplifies routing and middleware management
web server 3 tier architecture
presentation (client side UI)
logic (server side app logic)
data (data management)
what is the http response status code for success and client error
200
400
REST has stateless interactions what does that mean
each request is independent and server doesn’t store client state
CRUSD ops implemented through HTTP methods
Create: post
Read: get
Update: put
Delete: delete
hot linking
directly linking resources hosted on another server
CORS
cross origin resource sharing
defines how resources on a server can be requested from another domain
CSR patterns and SSR patterns
CSR
static file hosting
CSR (JS bundle renders into HTML)
CSR
- JS fetches data and rendered into HTML on client side
helpful for search and filter as fetches data from an API as user types
SSR
static site generation (pre renders HTML for static content, update required rebuild of site) good with few updates
SSR
- generates HTML on server for each request
hosts at network edge have 2 functions
sending function (break app msg up into smaller chunks (packets)
receiving function (receives from access network network and reassembles packets to generate application msg)
3 types of wired links
twisted pair
coaxial
fibre optic
type of wireless links
wireless radio
radio link types (bluetooth, satelite)
network core 2 functions
forwarding (switching) move packets from routers input link to appropriate router output link
local actions
routing
global action
determine source destination paths taken by packets
network protocol
standardised rules for data formatting transmission and receiving
common language for computers
TCP stands for
transmission control protocol
TCP/IP reference model layers
application
transport
network
link layer
physical
OSI reference model
2 more layers not implemented
under application
presentation
session
if they needed they are implemented in application layer
network performance metrics
bandwith
transmission max capacity
thoroughput
actual data transmission rate
packet loss
data packets that fail to reach their destination
2 types of network application arch CS and P2P
CS
-server provides services to clients and is dedicated, always on
clients request services by communicating with server and don’t communicate with each other
- pros centralised sytem to manage but the cons of that is single point of failure
P2P
- no dedicated server
- all act as both clients and servers and just communicate with each other
- supporting dynamic networks
- pros no single point of failure but cons difficult to control network traffic
application layer
Interfaces with end-user applications to enable services like web browsing, file transfer, and email
by defining how messages re formatted and exchanged
web caches
temporarily store web contents to decrease load time
proxy cache
browser sends all HTTP requests to web proxy
3 components of an email
user acgent
mail server
protocols
4 protocols for email sending
SMTP
sends emails from client to server and server to server
POP post office protocol
email retrieval fro a server to a client
IMAP internet message access protocol
synchronises email between server and client allowing access from multiple clients
can check email header before downloading
MIME multipurpose internet mail extensions
extend email functionality to support multimedia content
host @cs.otago.ac.nz wants IP address for ai.cs.waikato.ac.nz
requesting host from otago sends request to local DNS server
local DNS server contacts DNS server dns.ac.nz
this server contacts waikato.ac.nz DNS server who then contacts the DNS server of cs.waikato.ac.nz to retrieve IP ad then works its way back
TCP vs UDP
TCP
reliable data transfer with error checking
establishes handshake connection before data transfer
guarantee of packet arriving in correct order
UDP
no reliability to guarantee of segments arriving at all let alone in order or no error checking
sends data without establishing connection
good for video streaming where speed is prioritised
transport layer
Manages data delivery with reliability, segmentation, and reassembly using TCP (reliable) or UDP (faster, less reliable).
multiplexing
at sender
handles data from multiple sockets
add transport header
demultiplexing
at receiver end
uses header information to delivery received segments to correct socket
TCP 3 way handshake
establishes connection between client and server
client initiates by sending a SYN packet to the server and establishing an initial sequence number
server response with SYN-ACK packet acknowledging the client’s SYN sending its own sequence number
client sends an ACK packet back to the server to confirm server’s SYN-ACK and the connection is now established
flow control vs congestion control
flow control is one sender too fast for one receiver
congestion control is too many sources sending too much data too fast for network to handle
network layer
host to host communication
sender encapsulates segments into IP packets and passes to link layer
receiver delivers segments to TL layer and protocols are IPv4 and IPv6
2 key network layer functions
1) packet forwarding (control plane)
packets from incoming link to outgoing link within single router
2) routing (data plane)
- determining path that packets take from source to deviation across multiple routers t
CSR and SSR pros and cons
CSR
pros
- interactive content
cons
- no SEO
- not fast for CSR but for Static file host
SSR
pros
- useful for dynamic contetn
cons
- not fast for SSR but for FFS
- no interactive content
IPv4
defines how data is packaged, addressed, transmitted, routed, and received across networked devices
32 bits (network ID and host ID)
unreliable host to host communication protocol
IPv4 address split up into
5 classes
how many fields in header for IPv4
13
subnet
logical partition of an IP network into multiple smaller network segments
split host ID up into subnet ID and host ID
net mask
32 bit number with all 1s for network part and 0 for host part
IP fragmentation and header
network links have max transmission unit
in comes one large datagram and out goes 3 smaller datagrams
reassembled only at destination (IP header used to identify, order related frags)
- ID all same
- 3 flags bits indicating if more fragments to come
- offset of fragments in packets data field
network address translation
all devices in local network share just 1 IPv4 address
all datagrams leaving local network have same source NAT IP ad but different source port #s
IPv6 motivation
IPv4 exhaustion
IPv6
128 bits
40 byte fixed header length
written in hexadecimal
only 8 field in header eliminating check sum as e checking done at other layer
only OG sender not routers can fragment packets
TTL replaced with hop limit
security built in
introduces flow label field to increase handling of packets belonging to same flow for QoS
CIDR
classless inter domain routing
method for allocating IP addresses and IP routing
IPv4 to IPv6 and steps
tunneling
IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers
1) IPv6 packet encapsulated within IPv4 packet and IPV4 header added to the front of it
2) encapsulated packet sent over IPv4 network where IPv6 packet extracted
3) at destination IPv4 header stripped and original IPv6 packet processed
pre router control plane
individual routing algorithm components in each and every router in control plane
interact directly with neighbour
software defined networking control plane
remote controller computes, installs forwarding table in routers
centralizes control
routers share info with centralised controller not each othetr
expensive
what big orgs use
routing algorithms
path is sequence of routers packets traverse from given source host to destination host and goal is to find a good path
in routing algorithms cost of link is defined by
network operator
- always 1 (minimise hop count)
- inverse bandwith
- inverse congestion
2 types routing algorithm
global (link state)
decentralised (distance vector)
link state routing
global
each node gathers info and floods network with link state packets
dijkstras alg to calc least cost path from source
distance vector routing
decentralised
based on bellman ford algorithm (dynamic programming)
each router shares distance information with direct neighbours only
more eff in terms of complexity but slower convergence and issues like count to inf
if there is a router malfunction what happens link state vs vector distance
router advertises incorrect link cost and each router only computes its own table
router advertises incorrect path cost
each routers take used by others so e propagates through network
intra AS routing vs inter AS routing
intra is within AS
RIP : Distance vector
OSPF: link state
inter is between ASes
BGP: path vector
autonomous system
group of networks and routers controlled by single admin authority
ICMP and what ICMP msg contains
internet control message protocol
operates at network layer
used by routers and hosts to send network level info
supports e reporting, diagnostic functions
type + code + first 8 bytes of IP datagram, causing error
trace route and ICMP
source sends sets of UDP segments to destination
1st TTL=1 etc
each router returns ICMP msg when it discards packet due to TTL=0 allowing trace route to map path packets taken through network
Link layer
transfer datagram from 1 node to physically adjacent node over a link
hosts and routers and comms channels in link layer
hosts and routers all identical at link layer
communication channels that connect adjacent nodes along communication path=links (wired, wireless, LAN)
link layer 2 main services
framing and link access
- frame encapsulates data with headers and trailers included MAC addresses for source and destination distinct from IP address
reliable delivery
- provides flow control (for pacing transmissions) and error detection and correction
where is the link layer implemented
network interface card NIC or a chip
handles both link and physical layer
each NIC has a unique MAC addresses for identifying device with a network
MAC
medium access control
48 bits 6 groups of 2 hexadecimal digits
first 3 tell us manufacturer
flow control at transport and link layer
transport
- one host to another host
- end to end
- byte orientated
link layer
- single link
- frame orientated
- to adjacent devices
window size =
amount of data that can be sent from one device to another before requiring an acknowledgmen
sent not acked + usable not sent yet
error detection and 2 types
add bits to detect and correct bits error
not 100% reliable
exists at multiple layers
1) parity checking
2) cyclic redundancy check
single bit parity
detects singe bit error
if even # 1s add 0 and if add #1s add 1 more to make it even
even odd disparity can help us detect if something goes missing
2d bit parity
detect and correct single bit errors
can’t check bit in the row is wrong
cyclic redundancy check
more powerful detecting but can’t correct
checks if been corrupted by / by generator polynomial if non 0 remainder error detected
multiple access links and protocols
handling shares access to a channel
MAC protocol
medium/media accès protocol
determining when a node can transmit
communications about channel sharing must use channel itself
MAC protocols
dividing channel into small pieces to allocate piece to node for exclusive use
TDMA
time divided multiple access
divide time into slots and assigns each slot to a node in round robin fashion
FDMA
frequency divided multiple access
divide channels into frequency bands assigned to nodes
random access protocol and 4 types
contention based
pure aloha
transmit immediately
slotted aloha
synchronised transmissions to specific time slots
decntralised
CSMA, carrier sense multiple access
nodes listen first b4 transmission
don’t interrupt
CSMA/CD same as above but with collision detection
in ethernet nodes detect collisions early and abort transmission resuming after randomised backoff interval
polite person
abort transmission if collision occurs
taking turns MAC protocols
polling
- master node invites others to transmit in turn
- dumb devices with single point of failure
token passing
- control taken passed from one node to next sequentially
- avoids collisions
- single point of failure
physical layer
responsible for transmitting raw data bits over a physical medium
convert digital data into electrical/radio signals
LAN
local area network
connects devices within a limited area
wired or wireless
WAN
wide area network
telecommunication network that extends over a large geographical area
use leased telecommunication circuits
Ethernet
LAN tech for wired connections
ethernet topology
bus: all nodes in same collision
domain: can collide with each other
switched: switch in centre
ethernet standard
IEEE 802.3 standard
address resolution protocol
used to find MAC address associated with IP address on LAN
each device maintains ARP table holding IP to MAC mappings
what happens to packets if don’t like?
drop as easier to resend packets then trying to correct them
what happens if device doesn’t know MAC address?
broadcasts an ARP request, device with matching IP replies with its MAC address
ethernet switches characteristic
self learning
plug and play
transparent (hosts unaware of presence of switches)
store and forward
switches vs routers
switches
- link layer
- store and forward
- learn forwarding table using flooding, learning, MAC address
routers
- network layer
- store and forward
- computer tables using routing algorithms and IP addresses
TCP/IP model summed up
A is the layer we interact with as programmers coding via socket API
t uses TCP/UDP
N IPv4 or IPv6 occasionally ICMP
L ethernet
P electrons wiggling
student attaches laptop to campus network and requests/receives www.google.com
1) connecting to network
DHCP: client needs IP address and router and DNS server address obtained by DHCP request
this request encapsulated in UDP, IP and ethernet protocol layers and broadcasted acorss LAN
DHCP response: server respons to client with DHCP ACK reply with encapsulated msg containing clients IP adress, IP address of first hop router for client, name and UP address of DNS server
2) resolving the domain
sends ARP request to get MAC address of router
DNS query: client sends DNS query for www.google.com, router forwards to DNS server which reopens with google’s IP address
3) establish TCP connection
3 way handshake
client sends SYN request to open TCP connection to google’s IP
Google respons with SYN ACK and then client sends Google ACK to complete handshake establishing connection
4) HTTP request and response
sends HTTP request over TCP connection google server responds with web page which is routed back to the client and displayed in browser
infrastructure model vs ad hoc mode
wireless network architectires
- base station connects mobiles into wired network
- ad hoc no base stations
- only transmit to other notes within like coverage
- route among themselves
wireless link characteristics
signal attenuation
interference
multipath propagation
Snr increase as Berate decreases
cellular networks
solution for wide area mobile networks
base station (cell tower)
neighbour cells cannot use same set of frequencies
handoff
process of transferring ongoing call or data connectivity from one BS to another
hard handoff
break for make
soft handoff
make before break
roaming
customer still using cellular services when travelling outside coverage area of home network by using a visited network
confidentiality, authentication, message integrity for security
sender encrypts receiver decrypts
confirm identity of each other
no changes to message
bag guy could
eaves drop
intercept and insert msg into connection
impersonation
hijack
symmetric key cryptography
sender adn receievr use same key to encrypt and decrypt
faster
key needs to be store securely
secure channel needs to be used ofr key to be transferred without 3rd party obtaining
agree on key by one dewciding then telling
public key and 2 requirements
uses private and public key
public known to all but need private key known to receiever to decrypt
like prize behind a door example
1) satify formula K-(K+(m)))
2) given public key impossible to compute private key
encryption
encoding data into form can’t be read for unauthorized people
AP2.0, 3.0,4.0 5.0 failures?
2 fails if Ip spoofing used
3 replay attack
4 prove alice is live, bob sends alice a nonce R and alice must return R, encrypted with shares secret key
5 uses nonce public key cryptography
digital signatures
sender Bob digitally signs message by encrypting with his private key, when alice recieves she receiees m and signature (K-(m)) and usesBob’s key to decrypt msg
public key certification authorities
each certificate binds public key to an individual indentityy meaning Bob can verify that the public key indeed belongs to Alice
Certificate Authority (CA), to issue digital certificates.
transport layer security provides the 3
confidentiality via encryption
integrity via digital signature
authentication via public key cryptography
handshake TLS
alice sends msg to Bob using his pubic key
Bob will send it back using her public key
they decide on shares public key , shared key used for encryption
once keys derived switches back to symmetric key derivation
change cipher spec and alert protocols
deal with error by notifying closure of secure connection and reporting error
HTTPS is a
extension of HTTP over TLS
IPSEC
suite of protocols that provides secure communication over IP networks by authenticating and encrypting each IP packe
firewall
isolates orgs internal network from large internet allowing some packets to pass blocking others
3 types of firewalls
1) stateless packet filtering
apply rules to each packet independently based on IP, port protocol
2) stateful
tracks state of each connection
3) application gateways
con of firewall
cannot detect IP spoofing and limited capabilities against UDP attacks
intrusion detection system
performs deep packet inspection to detect suss activities
identify complex threats by comparing packet content to known attack signatures
firewall vs IDS
firewall
- control access based on rules
IDS
- search/monitor for anomalies and attacks
datacenters have how many tier switchers and why
2 to allow for more flexibility for routes and paths
less shares links to increase available links to decrease congestion
loan balancer
each request sent to different computer not to overload any particular computer
congestion notification
normally entirely up to sender to do congestion control
sender ramps up amount of data sends looking at ACKS until stops getting ACKS then says top overloaded should back off
software defined networking
introduces centralise control plane
integrity for messages
hash function takes m input and produces fixed size output called a hash
Alice can has message before sending to Bob and Bob can has again and compare hashes, if hashes match msg has not been altered