// InsertCIDR inserts an entry to 'cm' with key 'cidr'. Value is currently not
// used.
227
func (cm *CIDRMap) InsertCIDR(cidr net.IPNet) error {
	key := cm.cidrKeyInit(cidr)
	entry := [LPM_MAP_VALUE_SIZE]byte{}
	if err := cm.checkPrefixlen(&key, "update"); err != nil {
		return err
	}
	log.WithField(logfields.Path, cm.path).Debugf("Inserting CIDR entry %s", cidr.String())
	return bpf.UpdateElement(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&entry), 0)
}
972625
func MustParseCIDR(str string) *CIDR {
	c, err := ParseCIDR(str)
	if err != nil {
		panic(fmt.Sprintf("Unable to parse CIDR '%s': %s", str, err))
	}
	return c
}
1320162
func FormatAsCIDR(addresses []string) ([]string, error) {
	result := make([]string, len(addresses))
	for i, a := range addresses {
		cidr := a
		// If address is not already a cidr, add a /32 (ipv4) or /128 (ipv6).
		if _, _, err := net.ParseCIDR(a); err != nil {
			address, err := ResolverFunc("ip", a)
			if err != nil {
				return nil, errors.Trace(err)
			}
			if address.IP.To4() != nil {
				cidr = address.String() + "/32"
			} else {
				cidr = address.String() + "/128"
			}
		}
		result[i] = cidr
	}
	return result, nil
}
833379
func (tree *Tree) FindCIDR(cidr string) (interface{}, error) {
	return tree.FindCIDRb([]byte(cidr))
}
1209438
func hexCIDR(cidr string) (string, error) {
	ip, ipnet, err := net.ParseCIDR(cidr)
	if err != nil {
		return "", err
	}
	ip = ip.Mask(ipnet.Mask)
	hexIP := hex.EncodeToString([]byte(ip.To4()))
	hexMask := ipnet.Mask.String()
	return hexIP + "/" + hexMask, nil
}
111676
func (_class VBDClass) Insert(sessionID SessionRef, vbd VBDRef, vdi VDIRef) (_err error) {
	_method := "VBD.insert"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_vbdArg, _err := convertVBDRefToXen(fmt.Sprintf("%s(%s)", _method, "vbd"), vbd)
	if _err != nil {
		return
	}
	_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _vbdArg, _vdiArg)
	return
}
878658
func MustParseCIDR(s string) *CIDR {
	cidr, err := ParseCIDR(s)
	if err != nil {
		panic(err)
	}

	return cidr
}
261284
func (part *Partition) Insert(id int, data []byte) (physID int, err error) {
	physID, err = part.col.Insert(data)
	if err != nil {
		return
	}
	part.lookup.Put(id, physID)
	return
}
624260
func (dct *DjangoContentType) Insert(db XODB) error {
	var err error

	// if already exist, bail
	if dct._exists {
		return errors.New("insert failed: already exists")
	}

	// sql insert query, primary key provided by sequence
	const sqlstr = `INSERT INTO public.django_content_type (` +
		`app_label, model` +
		`) VALUES (` +
		`$1, $2` +
		`) RETURNING id`

	// run query
	XOLog(sqlstr, dct.AppLabel, dct.Model)
	err = db.QueryRow(sqlstr, dct.AppLabel, dct.Model).Scan(&dct.ID)
	if err != nil {
		return err
	}

	// set existence
	dct._exists = true

	return nil
}
270563
func (l *lNode) inserted(entry *Entry) *lNode {
	return &lNode{l.removed(entry).Add(&sNode{entry})}
}
285482
func (s *InputWhitelistRule) SetCidr(v string) *InputWhitelistRule {
	s.Cidr = &v
	return s
}
1122515
func CountIPsInCIDR(cidr string) int {
	_, ipnet, err := net.ParseCIDR(cidr)
	if err != nil {
		return 0
	}
	subnet, size := ipnet.Mask.Size()
	if subnet == size {
		return 1
	}
	return 1<<uint(size-subnet) - 1
}
792371
func (r *ChannelService) Insert(appId string, channelrequest *ChannelRequest) *ChannelInsertCall {
	c := &ChannelInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.appId = appId
	c.channelrequest = channelrequest
	return c
}
302970
func ValidateCIDR(cidr string) (*net.IPNet, error) {
	_, net, err := net.ParseCIDR(cidr)
	if err != nil {
		return nil, err
	}
	return net, nil
}
413171
func (v *Volume) insert() error {
	v.Log(DEBUG, "insert volume to sandbox")
	r := v.p.sandbox.AddVolume(v.descript)
	if !r.IsSuccess() {
		err := fmt.Errorf("failed to insert: %s", r.Message())
		v.Log(ERROR, err)
		return err
	}

	v.Log(INFO, "volume inserted")
	return nil
}
660673
func (t *Tree) Insert(rr dns.RR) {
	var d int
	t.Root, d = t.Root.insert(rr)
	t.Count += d
	t.Root.Color = black
}
418997
func (p *IDPool) Insert(id ID) bool {
	p.mutex.Lock()
	defer p.mutex.Unlock()

	return p.idCache.insert(id)
}